我需要为 A 列中的每个唯一值提取 B 列中的唯一值。 我有一个帖子的代码,但它列出了整个列的唯一值。 我想要的只是那些与我提供的过滤条件相关联的唯一值。
我需要将这些唯一值移动到一个数组中,并将其用于另一个工作表计算。 到目前为止,我拥有的代码如下。
Sub test()
Dim TestRg As Excel.Range
Dim Array1(200) As Variant
Dim i,j As Integer
i = 1
Set TestRg = Range("L1:L181")
TestRg.AdvancedFilter action:=xlFilterInPlace,CriteriaRange:= _
activeCell,Unique:=True
For Each C In TestRg.SpecialCells(xlCellTypeVisible)
If Not (C) Is Nothing Then
Array1(i) = C.Value
i = i + 1
End If
Next C
j = i - 1
i = 1
For i = 1 To j
Debug.Print Array1(i)
Next
End Sub
请帮忙。