Hello All,
I found this old Mr. Excel post while doing a search:
https://www.mrexcel.com/forum/excel...nique-values-multiple-columns-one-column.html
I have modified the code for my purposes to this:
My data is stored on a worksheet called DataCalcs.
The data I need the unique identifier on is in column AG on the DataCalcs page like this:
Altern 1
Altern 1
Altern 1
Altern 1
Altern 1
Altern 1
2
2
2
2
2
2
22
Base
Base
Base
Base
Base
Base
Base
Base
Base
Base
Base
Base
Base
Of course the data is 29 thousand plus rows.
I then want to attach this code to a menu item I have created on the ribbon to recognize the unique identifier in Column AG and display those items in the DataCalcs worksheet like using the Filter button.
I found this old Mr. Excel post while doing a search:
https://www.mrexcel.com/forum/excel...nique-values-multiple-columns-one-column.html
I have modified the code for my purposes to this:
Code:
Sub ThreeColDupes()
Dim MyDict As Object, MyCols As Variant, OutCol As String, LastRow As Long
Dim InputSh As Worksheet, OutputSh As Worksheet
Dim x As Variant, i As Long, MyData As Variant
Set MyDict = CreateObject("Scripting.Dictionary")
Set InputSh = Sheets("Sheet2")
MyCols = Array("A")
'MyCols = Array("A", "G", "L")
Set OutputSh = Sheets("Sheet2")
OutCol = "D"
For Each x In MyCols
LastRow = InputSh.Cells(Rows.Count, x).End(xlUp).Row
MyData = InputSh.Range(x & "1:" & x & LastRow).Value
For i = 1 To UBound(MyData)
If MyData(i, 1) <> "" Then MyDict(MyData(i, 1)) = 1
Next i
Next x
OutputSh.Range(OutCol & "1").Resize(MyDict.Count, 1).Value = WorksheetFunction.Transpose(MyDict.Keys)
End Sub
My data is stored on a worksheet called DataCalcs.
The data I need the unique identifier on is in column AG on the DataCalcs page like this:
Altern 1
Altern 1
Altern 1
Altern 1
Altern 1
Altern 1
2
2
2
2
2
2
22
Base
Base
Base
Base
Base
Base
Base
Base
Base
Base
Base
Base
Base
Of course the data is 29 thousand plus rows.
I then want to attach this code to a menu item I have created on the ribbon to recognize the unique identifier in Column AG and display those items in the DataCalcs worksheet like using the Filter button.