- ©«¤l
- 1446
- ¥DÃD
- 40
- ºëµØ
- 0
- ¿n¤À
- 1470
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Excel 2010 & 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2020-7-15
- ³Ì«áµn¿ý
- 2024-11-28
|
ÁÂÁ½׾Â,ÁÂÁ¦U¦ì«e½ú
«á¾ÇÂǦ¹©«½m²ß°}¦C»P¦r¨å,¾Ç²ß¤è®×¦p¤U,½Ð¦U¦ì«e½ú«ü±Ð
°õ¦æ«e:
°õ¦æµ²ªG:
Option Explicit
Sub TEST()
Dim Arr, Brr, Crr, Z, i&, j%, R
'¡ô«Å§iÅܼÆ
Set Z = CreateObject("Scripting.Dictionary")
'¡ô¥OZÅܼƬO ¦r¨å
R = Application.Match("¤pp", [A:A], 0)
'¡ô¥ORÅܼƬO ªí®æ¨ç¼ÆMatch()ªº¦^¶ÇÈ
If IsError(R) Then Exit Sub Else R = R - 1
'¡ô¦pªGRÅܼƬO¿ù»~È? True´Nµ²§ôµ{¦¡°õ¦æ,§_«h¥OR-1
Brr = Range([AS5], [AN65536].End(3))
'¡ô¥OBrrÅܼƬO ²±¸Ë¸ê®Æ®æȪº¤Gºû°}¦C
Crr = Range([A1], Cells(R, "AH"))
'¡ô¥OCrrÅܼƬO ²±¸Ë¾ãÓµ²ªG®æȪº¤Gºû°}¦C
ReDim Arr(4 To R, 4 To UBound(Crr, 2))
'¡ô¥OArrÅܼƬOµ²ªG¥Ø¼Ð®æ½d³òªºªÅ°}¦C
For i = 4 To R
'¡ô³]¶¶°j°é!i±q4¨ì RÅܼÆ
If Trim(Crr(i, 3)) <> "" Then Z(Trim(Crr(i, 3))) = i
'¡ô¦pªGi°j°é¦C/©m¦WÄæCrr°}¦CȤ£¬OªÅªº?
'True´N¥O©m¦W¬°key,item¬O¦C¸¹¯Ç¤JZ¦r¨å¤¤
Next
For i = 1 To UBound(Brr)
'¡ô³]¶¶°j°é!i±q1¨ì Brr°}¦CÁa¦V³Ì¤j¯Á¤Þ¸¹¦C(°j°é¶]¸ê®Æ°}¦C)
If Z(Trim(Brr(i, 1)) & "") = 0 Then GoTo i02
'¡ô¦pªG¸ê®Æ°}¦Ci°j°é¦C/©m¦WÄæ¬OªÅªº´N ¸õ¨ì¼Ð¥Üi02¦ì¸mÄ~Äò°õ¦æ
For j = Val(Brr(i, 2)) + 3 To Val(Brr(i, 4)) + 3
Arr(Z(Trim(Brr(i, 1)) & ""), j) = Brr(i, 6)
Next
'¡ô³]¶¶°j°é±N¥N½X¶ñ¤Jµ²ªG¥Ø¼Ð°}¦C¤¤
i02: Next
[D4].Resize(UBound(Arr) - 3, UBound(Arr, 2) - 3) = Arr
'¡ô¥Oµ²ªG¥Ø¼Ð®æ¶ñ¤JArr°}¦CÈ
End Sub |
|