ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¤ÀÂ÷¸ê®Æ

[µo°Ý] ¤ÀÂ÷¸ê®Æ

¤j¤j¦n,

½d¨Ò¤u§@ªí¤¤,AÄ榳¤¤­^or­^¼Æ²V¦X,AÄ檺¦C¼Æ·|¦]«È¤á¤U³æ¦³¼W¥[or´î¤Ö¸ê®Æ,©Ò¥H¨S¦³¤@©wªº¦C¼Æ,°£¤FAÄæ,¨ä¾lÄæ¦ì³£¥i¯à·|¦³¤½¦¡¦s¦b.

½Ð°Ý¦p¦ó¤ÀÂ÷AÄæ¸ê®Æ¦ÜX/YÄæ,¦p½d¨Ò©Ò¥Ü?

½d¨Ò_¤ÀÂ÷¸ê®Æ.rar (31.96 KB)

¦^´_ 1# PJChen


    ÁÂÁ½׾Â,ÁÂÁ¦U¦ì«e½ú,ÁÂÁ«e½úµoªí¦¹¥DÃD»P½d¨Ò
«á¾ÇÂǦ¹©«½m²ßVBA,¾Ç²ß¤è®×¦p¤U,½Ð«e½ú°Ñ¦Ò

°õ¦æ«e:


°õ¦æµ²ªG:


Option Explicit
Sub TEST()
Dim Brr, Crr, i&, Q$, X$, T$, P$, Jm%, j%, Y$
Brr = Range([A2], Cells(Rows.Count, "A").End(3))
ReDim Crr(1 To UBound(Brr), 1 To 2)
For i = 1 To UBound(Brr)
   Q = Trim(Brr(i, 1))
   For j = 1 To Len(Q)
      T = Mid(Q, j, 1)
      If T <> Evaluate("LeftB(""" & T & """,1)") Then Jm = Jm + 1: P = P & T
   Next
   P = Switch(Jm > 0, P, Q Like "[A-Z]*######GP##", Right(Q, 10), P = P, "")
   Y = IIf(P = "", "µL", P): P = Replace(Q, P, "")
   X = IIf(P = "", "µL", P): Crr(i, 1) = X: Crr(i, 2) = Y
   P = "": Jm = 0
Next
Intersect(ActiveSheet.UsedRange.Offset(1, 0), [X:Y]).ClearContents
[X2].Resize(UBound(Crr), 2) = Crr
Erase Brr, Crr
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

D2:E5=TRIM(MID(REPLACE($B2,MIN(FIND(ROW($1:$10)-1,$B2&1/17)),,REPT(" ",99)),COLUMN(A1)*99-98,99))[img][/img]

11329.png (6.25 KB)

11329.png

google"EXCEL°g"  blog  ©Îgoogleºô§}:https://hcm19522.blogspot.com/

TOP

¦^´_ 2# Andy2483


    ÁÂÁ½׾Â,ÁÂÁ¦U¦ì«e½ú
«á¾Ç½Æ²ß³o©«¤è®×,¾Ç²ß¤ß±oµù¸Ñ¦p¤U,½Ð¦U¦ì«e½ú«ü±Ð

Option Explicit
Sub TEST()
Dim Brr, Crr, i&, Q$, X$, T$, P$, Y$, Jm%, j%
'¡ô(Brr,Crr)¬O³q¥Î«¬ÅܼÆ,i¬Oªø¾ã¼Æ,(Q,X,T,P,Y)¬O¦r¦êÅܼÆ,(Jm,j)¬Oµu¾ã¼Æ
Brr = Range([A2], Cells(Rows.Count, "A").End(3))
'¡ô¥OBrr³o³q¥Î«¬ÅܼƬO ¤Gºû°}¦C,¥H[A2]¨ìAÄæ³Ì«á¤@­Ó¦³¤º®eÀx¦s®æ­È±a¤J
ReDim Crr(1 To UBound(Brr), 1 To 2)
'¡ô«Å§iCrrÅܼƬO¤Gºû°}¦C,Áa¦V½d³ò±q1¨ì Brr°}¦CÁa¦V¯Á¤Þ¦C¸¹,
'¾î¦V½d³ò±q1¨ì 2

For i = 1 To UBound(Brr)
'¡ô³]¶¶°j°é!i±q1¨ì Brr°}¦CÁa¦V¯Á¤Þ¦C¸¹
   Q = Trim(Brr(i, 1))
   '¡ô¥OQ³o¦r¦êÅܼƬO i°j°é¦C²Ä1ÄæBrr°}¦C­È¥h°£ÀY§ÀªÅ¦r¤¸«áªº·s¦r¦ê
   For j = 1 To Len(Q)
   '¡ô³]¶¶°j°é!j±q1¨ì Q¦r¦ê¦r¤¸¼Æ
      T = Mid(Q, j, 1)
      '¡ô¥OT³o¦r¦êÅܼƬOQÅܼƨújÅܼƶ}©lªº1­Ó¦r
      If T <> Evaluate("LeftB(""" & T & """,1)") Then Jm = Jm + 1: P = P & T
      '¡ô¦pªGTÅܼƻP TÅܼƨú1­Ó¦ì¤¸¦^¶Ç­È¤£¬Û¦P!´N¥OJm³oµu¾ã¼Æ²Ö¥[1,
      '¥OP³o¦r¦êÅܼƬO¦Û¨­³s±µTÅܼƩҲզ¨ªº·s¦r¦ê  (PS:°ê¦r¬OÂù¦ì¤¸²Õ¦¨ªº¦r¤¸)

   Next
   P = Switch(Jm > 0, P, Q Like "[A-Z]*######GP##", Right(Q, 10), P = P, "")
   '¡ô¥OPÅܼƬOSwitch ¨ç¼Æ¦^¶Ç­È,
   '¦pªG¦³Âù¦ì¤¸ªº¦r¤¸,´N¦^¶ÇP¬O¦Û¨­­È
   '¦pªGQ¦r¦êªº²Õ¦X¬O­^¤å¦r¶}ÀY,¦A³s±µ6­Ó(§t)¥H¤W¼Æ¦r¦r¤¸,Äò³s±µ"GP"¦r¤¸,
   '³Ì«á³s±µ¨â­Ó¼Æ¦r¦r¤¸,´N¦^¶ÇP¬OQ¦r¦êªº¥kÃä10­Ó¦r¤¸
   '¦pªG«e­±¨â­Ó§PÂ_³£¤£¦¨¥ß!´N¦^¶ÇP¬OªÅ¦r¤¸

   Y = IIf(P = "", "µL", P): P = Replace(Q, P, "")
   '¡ô¥OY³o¦r¦êÅܼƬOIIf¨ç¼Æ¦^¶Ç­È,
   '¦pªGPÅܼƬO ªÅ¦r¤¸,´N¦^¶ÇY¬O "µL"¦r¤¸,§_«h´N¦^¶ÇY¬O PÅܼƭÈ,
   '¥OPÅܼƬOQÅܼƱN©Ò§tªºPÅܼƭȸm´«¬°ªÅ¦r¤¸

   X = IIf(P = "", "µL", P): Crr(i, 1) = X: Crr(i, 2) = Y
   '¡ô¥OX³o¦r¦êÅܼƬOIIf¨ç¼Æ¦^¶Ç­È,
   '¦pªGPÅܼƬO ªÅ¦r¤¸,´N¦^¶ÇX¬O "µL"¦r¤¸,§_«h´N¦^¶ÇX¬O PÅܼƭÈ,
   '¥Oi°j°é¦C²Ä1ÄæCrr°}¦C­È¬O XÅܼƭÈ
   '¥Oi°j°é¦C²Ä2ÄæCrr°}¦C­È¬O YÅܼƭÈ

   P = "": Jm = 0
   '¡ô¥OPÅܼƬO ªÅ¦r¤¸,¥OJmÅܼÆÂk¹s
Next
Intersect(ActiveSheet.UsedRange.Offset(1, 0), [X:Y]).ClearContents
'¡ô¥O¨â°ÏÀx¦s®æ¬Û¥æ¶°ªºÀx¦s®æ²M°£¤º®e
'²Ä¤@°Ï:¥»ªí¦³¨Ï¥ÎªºÀx¦s®æ¦V¤U°¾²¾¤@¦Cªº½d³òÀx¦s®æ
'¥t¤@°Ï:¥»ªíªºX:YÄæÀx¦s®æ

[X2].Resize(UBound(Crr), 2) = Crr
'¡ô¥O[X2]ÂX®i¦V¤UCrr°}¦CÁa¦V³Ì¤j¯Á¤Þ¦C¸¹,¦V¥kÂX®i2Äæ,
'³o½d³òÀx¦s®æ­È¥HCrr°}¦C­È±a¤J

Erase Brr, Crr
'¡ô¥OÄÀ©ñÅܼÆ
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

        ÀR«ä¦Û¦b : ·R¤£¬O­n¨D¹ï¤è¡A¦Ó¬O­n¥Ñ¦Û¨­ªº¥I¥X¡C
ªð¦^¦Cªí ¤W¤@¥DÃD