The macro below does perform the task I need correctly. It takes the values from column A&B and insert them into column C. The Input Box entries are A:B on the first and C1 on the second one. I would like to remove the input boxes and have the macro run without user input. The sheet will always be Date_Validation using columns A:B with an input into C. The macro below uses C1 as the input cell where in column C both A&B columns are joined with only unique values remaining. The macro does appear to calculate for a header since you select C1 but the data starts in C2. Can this be cleaned up to just run without input. I don't understand the code below, any help would be great so I can learn
Thanks
Sub FindUniques()
'Updateby20140313
Sheets("Date_Validation").Select
'Added Range to test
Range("A:B").Select
Dim rng As Range
Dim InputRng As Range, OutRng As Range
xTitleId = "KutoolsforExcel"
Set InputRng = Application.Selection
Set InputRng = Application.InputBox("Range A:B :", xTitleId, InputRng.Address, Type:=8)
Set OutRng = Application.InputBox("Output to ( C1 ):", xTitleId, Type:=8)
Set dic = CreateObject("Scripting.Dictionary")
For j = 1 To InputRng.Columns.Count
For i = 1 To InputRng.Rows.Count
xValue = InputRng.Cells(i, j).Value
If xValue <> "" And Not dic.Exists(xValue) Then
OutRng.Value = xValue
dic(xValue) = ""
Set OutRng = OutRng.Offset(1, 0)
End If
Next
Next
End Sub
Bookmarks