- ©«¤l
- 976
- ¥DÃD
- 7
- ºëµØ
- 0
- ¿n¤À
- 1018
- ÂI¦W
- 0
- §@·~¨t²Î
- Win10
- ³nÅ骩¥»
- Office 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2013-4-19
- ³Ì«áµn¿ý
- 2024-12-18
|
§A¦n,¤j¤j,ÁÂÁ§A¦A¦¸À°¦£,¦n¹³®t¤@ÂISheet1 ¬O¸ê®Æ¨Ó·½,
·í§Ú¦bSheet2 ¥´¤WJob ©MLine «á,Sheet2ªº ...
stephenlee µoªí©ó 2022-8-10 13:52
¬O³o¼Ë¶Ü? ½Ð´ú¸Õ¬Ý¬Ý¡AÁÂÁÂ
Sub test()
Dim Arr, xD, T$, br, a1$, a2$, ky, i&
Set xD = CreateObject("Scripting.Dictionary")
Arr = Sheets(1).Range("a1").CurrentRegion
For i = 2 To UBound(Arr)
T = Arr(i, 1) & "|" & Arr(i, 2): xD(T) = Arr(i, 3)
Next
With Sheets(2)
Arr = .Range("a1").CurrentRegion
For i = 2 To UBound(Arr)
T = Arr(i, 1) & "|" & Arr(i, 2)
If xD.Exists(T) Then
Arr(i, 3) = xD(T)
Else
a1 = Split(Arr(i, 2), "-")(0): a2 = Split(Arr(i, 2), "-")(1)
For Each ky In xD.keys
If Split(ky, "|")(0) <> Arr(i, 1) Then GoTo 98
br = Split(Split(ky, "|")(1), "-")
If UBound(br) < 1 Then GoTo 98
If br(0) <= a1 And br(1) >= a2 Then Arr(i, 3) = xD(ky)
98: Next
End If
Next
.[a1].Resize(UBound(Arr), 3) = Arr
End With
End Sub |
|