[英]How to extract unique values from two columns Excel VBA
我需要获取列(A)和列(C)之间的唯一值才能在列(E)中显示
This code: 这段代码:
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
will produce this type of result: 将产生这种类型的结果:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.