Hi,
Can somebody please help me to modify the code below instead of changing the sheets name to compare in the code every time want to compare sheets instead to prompt for the sheets names to compare.
Code:
thank you
Can somebody please help me to modify the code below instead of changing the sheets name to compare in the code every time want to compare sheets instead to prompt for the sheets names to compare.
Code:
Code:
Dim sh1 As Worksheet, sh2 As Worksheet, c As Range, f As Range, mydiffs As Long Dim r1 As Range, r2 As Range
Set sh1 = Sheets("JUL")
Set sh2 = Sheets("AUG")
Set r1 = sh1.Range("A3", sh1.Range("A" & Rows.Count).End(xlUp))
Set r2 = sh2.Range("A3", sh2.Range("A" & Rows.Count).End(xlUp))
r1.Interior.Color = vbWhite
r2.Interior.Color = vbWhite
For Each c In r1
Set f = r2.Find(c, , xlValues, xlWhole)
If f Is Nothing Then
c.Interior.Color = vbRed
mydiffs = mydiffs + 1
End If
Next
For Each c In r2
Set f = r1.Find(c, , xlValues, xlWhole)
If f Is Nothing Then
c.Interior.Color = vbRed
mydiffs = mydiffs + 1
End If
Next
MsgBox mydiffs & " differences found"
End Sub
thank you