- ©«¤l
- 354
- ¥DÃD
- 5
- ºëµØ
- 0
- ¿n¤À
- 387
- ÂI¦W
- 0
- §@·~¨t²Î
- windows7
- ³nÅ骩¥»
- vba,vb,excel2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2017-1-8
- ³Ì«áµn¿ý
- 2024-8-2
|
¦^´_ 3# 198188
GPT4
Sub test()
' ©w¸qÅܶq¨Ãªì©l¤ÆÅܶqr¬°²Ä¤@¦C³Ì«á¤@Ó«DªÅ¦æªº¦æ¸¹
r = Cells(Rows.Count, 1).End(xlUp).Row
' ªì©l¤Æ¿é¥X°_©lªº¦C¸¹c¬°²Ä7¦C¡]§YG¦C¡^
c = 7
' ²M°£±qH2¨ìJ1000ªº¤º®e¡A¬°·sªº¿é¥X°µ·Ç³Æ
Range("H2:J1000").ClearContents
' ±q²Ä¤T¦æ¶}©l°j°é¡Aª½¨ì³Ì«á¤@Ó«DªÅ¦æ
For i = 3 To r
' Àˬd·í«e¦æ²Ä¤@¦Cªº³æ¤¸®æ¬O§_¤£¬°ªÅ
If Cells(i, 1).Value <> "" Then
' ³q¹L¤À³Î³æ¤¸®æȨèú²Ä¤@Ó¤¸¯À¨Ó´£¨ú¥ô°È¥N½X
tx = Split(Cells(i, 1).Value, " ")(0)
' ½T©w·í«e³æ¤¸®æ¦X¨Ö°Ï°ìªº¼Æ¶q
mr = Cells(i, 1).MergeArea.Count
' ¦pªG¦s¦b¦X¨Öªº³æ¤¸®æ
If mr > 0 Then
' ¹M¾ú¦X¨Ö°Ï°ì¤¤ªº¨Cӳ椸®æ¡A±Æ°£²Ä¤@ӳ椸®æ¡]¦]¦¹¨Ï¥Îmr - 1¡^
For Each Z In Cells(i, 2).Resize(mr - 1, 5)
' ¦pªG³æ¤¸®æ¥]§t"SR"¦r¼Ë
If UCase(Z.Value) Like "*SR*" Then
' ¤À³ÎÈ¥HÀò¨úSR½s¸¹¡A¥h°£¬A¸¹
sp = Split(Z.Value, "(")(0)
' ±qSR½s¸¹¤¤²¾°£"¤W¬["¡B"¤U¬["©MªÅ®æ
sp = Replace(sp, "¤W¬[", "")
sp = Replace(sp, "¤U¬[", "")
sp = Replace(sp, " ", "")
' ¥Î"¡¶"§@¬°¤À¹j²Å¡A±NSR½s¸¹ªþ¥[¨ì¥ô°È¥N½X«á±
tx = tx & "¡¶" & sp
End If
Next
' ²¾°Ê¨ì¤U¤@¦C¿é¥X¦ì¸m
c = c + 1
' ³q¹L¤À¹j²Å"¡¶"¤À³Î½sĶ«áªº¥ô°È¥N½X©MSR½s¸¹
sp0 = Split(tx, "¡¶")
' ±NSR½s¸¹¼Æ²ÕÂà¸m¨Ã±q·í«e¦C¶}©l¼g¤J¤u§@ªí
Cells(2, c).Resize(UBound(sp0) + 1, 1) = Application.Transpose(sp0)
End If
End If
Next
End Sub
³o¬qVBA§»ªº¥Øªº¬O±N¥ô°È¦Cªí¤¤ªº¡§SR¡¨½s¸¹®Ú¾Ú²Ä¤@¦C«ü©wªº¥ô°È¾ã²z¨ì¤£¦Pªº¦C¤¤¡C¥¦·|¥ý²M°£«ü©w½d³òªº¤º®e¡A±µµÛ³B²z¸ê®Æ¨Ã¤À³Î¦r¦ê¡A³Ì«á±N¾ã²z¦nªº¿é¥XÂà¸m¦Ü¤u§@ªí¤¤¡C³o¨Çµù¸ÑÀ³¸Ó¯àÀ°§U§A²z¸Ñ³oÓ§»ªºÅÞ¿è©M¬yµ{¡C |
|