- ©«¤l
- 163
- ¥DÃD
- 1
- ºëµØ
- 0
- ¿n¤À
- 170
- ÂI¦W
- 0
- §@·~¨t²Î
- Window 7
- ³nÅ骩¥»
- Office 2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-9-5
- ³Ì«áµn¿ý
- 2022-7-20
|
¦^´_ 1# Changbanana
¥Î¤F¤@ÓDictionaryª«¥ó¡A¬Ý¬Ý°õ¦æ³t«×¬O§_¯à´£¤É¡H- Sub test()
- Dim d As Object
- Set d = CreateObject("Scripting.Dictionary")
- Dim arr, brr()
- With Sheets("¤u§@ªí2")
- er = .[A65536].End(3).Row
- arr = .Range("A2:B" & er)
- End With
- For i = 1 To UBound(arr)
- If d.exists(arr(i, 2)) Then
- d(arr(i, 2)) = "¡ô"
- Else
- d(arr(i, 2)) = "'" & arr(i, 1)
- End If
- Next i
- With Sheets("¤u§@ªí1")
- .Range("G2:G65536").ClearContents
- er = .[A65536].End(3).Row
- arr = .Range("A2:B" & er)
- End With
- For i = 1 To UBound(arr)
- If d.exists(arr(i, 1)) Then
- If d(arr(i, 1)) = "¡ô" Then
- arr(i, 2) = ""
- n = n + 1
- ReDim Preserve brr(1 To n)
- brr(n) = arr(i, 1)
- Else
- arr(i, 2) = d(arr(i, 1))
- End If
- Else
- arr(i, 2) = ""
- End If
- Next i
- Sheets("¤u§@ªí1").[A2].Resize(UBound(arr), 2) = arr
- Sheets("¤u§@ªí1").[G2].Resize(UBound(brr), 1) = Application.Transpose(brr)
- Set d = Nothing
- arr = ""
- Erase brr
- End Sub
½Æ»s¥N½X |
|