|
- Sub test()
- Dim r%, i%
- Dim arr, brr
- Dim d As Object
- Set d = CreateObject("scripting.dictionary")
- With Worksheets("sheet1")
- If Selection.Cells.Count = 1 Then
- ReDim arr(1 To 1, 1 To 1)
- arr(1, 1) = Selection
- Else
- arr = Selection
- End If
- For i = 1 To UBound(arr)
- For j = 1 To UBound(arr, 2)
- If Len(arr(i, j)) <> 0 Then
- d(arr(i, j)) = Empty
- End If
- Next
- Next
- End With
- With Worksheets("sheet2")
- .Range("d9:d" & .Rows.Count).Clear
- If d.Count > 0 Then
- .Range("d9").Resize(d.Count, 1) = Application.Transpose(d.keys)
- End If
- End With
- End Sub
复制代码 |
|