As per forum rules, you need to edit that post above and add CODE tags around the code like I'll show here (demonstrated in my signature as well).
Try this:
Option Explicit
Sub CompareColumns()
Dim Col1 As Range, Col2 As Range, LR1 As Long, LR2 As Long
On Error Resume Next
Col1 = Application.InputBox("Click any cell in first column", "Select", Type:=8).Address
Set Col1 = ActiveCell
Col2 = Application.InputBox("Click any cell in second column", "Select", Type:=8).Address
Set Col2 = ActiveCell
If Col1.Column = Col2.Column Then
MsgBox "Cannot compare a column to itself"
Exit Sub
Else
LR1 = Cells(Rows.Count, Col1.Column).End(xlUp).Row
LR2 = Cells(Rows.Count, Col2.Column).End(xlUp).Row
LR1 = Application.WorksheetFunction.Max(LR1, LR2)
With Range("XFD1:XFD" & LR1)
.FormulaR1C1 = "=EXACT(RC" & Col1.Column & ",RC" & Col2.Column & ")"
.Value = .Value
End With
MsgBox "Done"
End If
End Sub
Bookmarks