如何从两列Excel VBA中提取唯一值

我需要在列(E)和列(C)之间得到唯一的值,

此代码:

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 

会产生这样的结果:

在这里输入图像描述