我需要在列(E)中显示列(A)和列(C)之间的唯一值
答案 0 :(得分:1)
此代码:
Sub GetUniques()
Dim Na As Long, Nc As Long, Ne As Long
Dim i As Long
Na = Cells(Rows.Count, "A").End(xlUp).Row
Nc = Cells(Rows.Count, "C").End(xlUp).Row
Ne = 1
For i = 1 To Na
Cells(Ne, "E").Value = Cells(i, "A").Value
Ne = Ne + 1
Next i
For i = 1 To Na
Cells(Ne, "E").Value = Cells(i, "C").Value
Ne = Ne + 1
Next i
Range("E:E").RemoveDuplicates Columns:=1, Header:=xlNo
End Sub
会产生这种结果: