I need unique values in 2 columns to be pasted into another sheet in 2 columns.
I used this one but it pastes the values into 1 column
Sub ManyColDupes()
Dim MyDict As Object, InputRange As Range, OutputCol As Range, z As Variant, c As Variant
Set MyDict = CreateObject("Scripting.Dictionary")
Set InputRange = Sheets("Sheet6").Range("D1:BS1,CC1")
Set OutputCol = Sheets("Sheet7").Range("X1")
On Error Resume Next
For Each c In InputRange
For Each z In Range(c, c.Offset(Rows.Count - 1).End(xlUp))
If z <> "" Then MyDict(CStr(z)) = 1
Next z
Next c
OutputCol.Resize(MyDict.Count, 1).Value = WorksheetFunction.Transpose(MyDict.keys)
End Sub
Example
Column D must be pasted into the other sheet in Column B, and Column E needs to be pasted in the other sheet in Column C
Vendor Name Site
Premier Site 1
Premier Site 2
Nativa X
Cosmic Fashion Site C
MC Site X
MC Site Y
I used this one but it pastes the values into 1 column
Sub ManyColDupes()
Dim MyDict As Object, InputRange As Range, OutputCol As Range, z As Variant, c As Variant
Set MyDict = CreateObject("Scripting.Dictionary")
Set InputRange = Sheets("Sheet6").Range("D1:BS1,CC1")
Set OutputCol = Sheets("Sheet7").Range("X1")
On Error Resume Next
For Each c In InputRange
For Each z In Range(c, c.Offset(Rows.Count - 1).End(xlUp))
If z <> "" Then MyDict(CStr(z)) = 1
Next z
Next c
OutputCol.Resize(MyDict.Count, 1).Value = WorksheetFunction.Transpose(MyDict.keys)
End Sub
Example
Column D must be pasted into the other sheet in Column B, and Column E needs to be pasted in the other sheet in Column C
Vendor Name Site
Premier Site 1
Premier Site 2
Nativa X
Cosmic Fashion Site C
MC Site X
MC Site Y