- ©«¤l
- 1447
- ¥DÃD
- 40
- ºëµØ
- 0
- ¿n¤À
- 1471
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Excel 2010 & 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2020-7-15
- ³Ì«áµn¿ý
- 2024-12-5
|
¥»©«³Ì«á¥Ñ Andy2483 ©ó 2023-12-1 16:21 ½s¿è
ÁÂÁ½׾Â,ÁÂÁ¦U¦ì«e½ú
«á¾ÇÂǦ¹©«½m²ß°}¦C»P¦r¨å,¾Ç²ß¤è®×¦p¤U,½Ð¦U¦ì«e½ú«ü±Ð
°õ¦æ«e:
°õ¦æµ²ªG:
Option Explicit
Sub TEST()
Dim Brr, Crr, v, Z, i&, j, C, T$
'¡ô«Å§iÅܼÆ
Set Z = CreateObject("Scripting.Dictionary")
'¡ô¥OZÅܼƬO¦r¨å
C = Application.Match("¥æ³f¤é´Á", [3:3], 0)
'¡ô¥OCÅܼƬO°õ¦æªí®æ¨ç¼Æ Match()ªº¦^¶ÇÈ (²Ä3¦C¸Ì§ä Àx¦s®æȬO "¥æ³f¤é´Á")
If IsError(C) Then Exit Sub
'¡ô¦pªGCÅܼƬO¿ù»~È (Match()§ä¤£¨ì²Å¦XªºÀx¦s®æ!·|¦^¶Ç¿ù»~È)
'©Ò¥HCÅܼƥ²¶·«Å§i¬°³q¥Î«¬ÅܼÆ
Brr = Range(Cells(1, C), [A65536].End(xlUp))
'¡ô¥OBrrÅܼƬO¸Ë¤JÀx¦s®æȪº¤Gºû°}¦C
For j = 1 To C
'¡ô³]¶¶°j°é!j±q1 ¨ìCÅܼÆ
T = T & Trim(Brr(2, j))
'¡ô¥OTÅܼƬO³s±µ °j°é¦C2Äæ°}¦CÈ¥h°£«e«áªÅ¥Õ¦r¤¸«áªº·s¦r¦ê
If Trim(Brr(3, j)) = "¯ÊÃB" Then Z(j) = T: T = ""
'¡ô¦pªG°j°é¦C2Äæ°}¦CÈ¥h°£«e«áªÅ¥Õ¦r¤¸«áªº·s¦r¦ê¬O "¯ÊÃB"?,
'True´N¥OjÅܼƬ°Key,Item¬O TÅܼÆ,¯Ç¤JZ¦r¨å¸Ì,µM«áTÅܼƲMªÅ
Next
For i = 4 To UBound(Brr)
'¡ô³]¶¶°j°é!i±q4¨ìBrr°}¦CÁa¦V³Ì¤j¯Á¤Þ¦C¸¹
Brr(i - 3, 1) = ""
'¡ô¥O°}¦C¸Ìªº1Äæ¬Û¹ï¦ì¸m¦C°}¦CȬOªÅ¦r¤¸
For Each j In Z.KEYS
'¡ô³]³v¶µ°j°é!¥OjÅܼƬO Z¦r¨å¸ÌªºKeys¤§¤@
If Val(Brr(i, j)) < 0 Then Brr(i - 3, 1) = Z(j): Exit For
'¡ô¦pªG°j°é¦C¯ÊÃBÄæ¸Ìªº¼ÆȤp©ó0?
'True´N¥O°}¦C¸Ìªº1Äæ¬Û¹ï¦ì¸m¦C°}¦CȬO jÅܼƬdZ¦r¨å¦^¶ÇÈ
Next
Next
Cells(4, C).Resize(UBound(Brr) - 2, 1) = Brr
'¡ô¥Oµ²ªG¦ì¸mÀx¦s®æ½d³ò¼g¤JBrr°}¦CÈ
End Sub |
|