回復 1#myleoyes
Sub 清單() 'Dictionary 物件
Dim D As Object
Set D = CreateObject("SCRIPTING.DICTIONARY")
With Sheet1
For Each E In .Range("C2", .Range("C2").End(xlToRight))
D(E.Value) = ""
Next
.[A3].Resize(D.Count, 1) = Application.Transpose(D.KEYS)
End With
End Sub
Sub 清單() 'Array
Dim Ar()
ReDim Preserve Ar(0)
With Sheet1
Ar(0) = .[C2]
For Each E In .Range("D2", .Range("D2").End(xlToRight))
If UBound(Filter(Ar, E, True)) = -1 Then
ReDim Preserve Ar(UBound(Ar) + 1)
Ar(UBound(Ar)) = E
End If
Next
.[A3].Resize(UBound(Ar) + 1, 1) = Application.Transpose(Ar)
End With
End Sub作者: myleoyes 時間: 2010-5-16 21:54
回復 6#myleoyes
Sub 清單() 'Dictionary 物件
Dim D As Object
Set D = CreateObject("SCRIPTING.DICTIONARY")
With Sheet1
For Each E In .Range("C2", .Range("IV2").End(xlToLeft))
If E <> "" Then D(E.Value) = ""
Next
.[A3].Resize(D.Count, 1) = Application.Transpose(D.KEYS)
End With
End Sub
Sub 清單S() 'Array
Dim Ar()
ReDim Preserve Ar(0)
With Sheet1
Ar(0) = .[C2]
For Each E In .Range("D2", .Range("IV2").End(xlToLeft))
If E <> "" Then
If UBound(Filter(Ar, E, True)) = -1 Then
ReDim Preserve Ar(UBound(Ar) + 1)
Ar(UBound(Ar)) = E
End If
End If
Next
.[A3].Resize(UBound(Ar) + 1, 1) = Application.Transpose(Ar)
End With
End Sub作者: myleoyes 時間: 2010-5-17 22:14