just for your amusement
Sub samecolumns()
Dim a(), b As Object, c, d, e As Long
Set b = CreateObject("scripting.dictionary")
With Cells(1).CurrentRegion
ReDim a(1 To .Columns.Count)
For Each d In .Columns
c = Join(Application.Transpose(d), Chr(2))
If Not b.exists(c) Then
b(c) = b.Count + 1
a(b(c)) = .Columns(d.Column).Address(0, 0)
Else
a(b(c)) = a(b(c)) & ", " & .Columns(d.Column).Address(0, 0)
End If
Next d
End With
For Each d In a
If InStr(d, ", ") > 0 Then
e = e + 1
Range(d).Interior.ColorIndex = e + 2
End If
Next d
End Sub
Bookmarks