- ©«¤l
- 4901
- ¥DÃD
- 44
- ºëµØ
- 24
- ¿n¤À
- 4916
- ÂI¦W
- 247
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Office 20xx
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥x¥_
- µù¥U®É¶¡
- 2010-4-30
- ³Ì«áµn¿ý
- 2024-11-14
|
¥»©«³Ì«á¥Ñ Hsieh ©ó 2013-1-12 00:10 ½s¿è
¦^´_ 8# adam2010
Sheets("¥æ´Á")ªºDÄæ¼Æ¶q¬O¤H¤u¥ý¿é¤J¦nªº¶Ü?
¸Õ¸Õ¬Ý- Sub ex()
- Dim Ar(), Ay(), C As Range, Rng As Range
- Set d = CreateObject("Scripting.Dictionary") '¼Æ¶q
- Set d1 = CreateObject("Scripting.Dictionary") '¤é´Á
- With Sheets("¥X³f¤é")
- For Each a In .Range(.[A2], .[A2].End(xlDown)) 'ª«®Æ
- Set Rng = a.EntireRow.SpecialCells(xlCellTypeConstants, xlNumbers) 'q³f
- ReDim Preserve Ar(s) '¼Æ¶q
- ReDim Preserve Ay(s) '¤é´Á
- Ar(s) = 0
- Ay(s) = .Cells(1, Rng.Column)
- s = s + 1
- For Each C In Rng
- cnt = cnt + C
- ReDim Preserve Ar(s)
- ReDim Preserve Ay(s)
- Ar(s) = cnt
- Ay(s) = .Cells(1, C.Column).Value
- s = s + 1
- Next
- d(a.Value) = Ar
- d1(a.Value) = Ay
- Erase Ar: Erase Ay: s = 0: cnt = 0
- Next
- End With
- With Sheets("¥æ´Á")
- For Each a In .Range(.[A2], .[A2].End(xlDown))
- cnt = cnt + a.Offset(, 3)
- If cnt <= Application.Max(d(a.Value)) Or cnt - a.Offset(, 3) < Application.Max(d(a.Value)) Then _
- a.Offset(, 4) = Application.Lookup(cnt, d(a.Value), d1(a.Value)) _
- Else a.Offset(, 4) = "NA"
- If a <> a.Offset(1) Then cnt = 0
- Next
- End With
- End Sub
½Æ»s¥N½X |
|