Thread: macro
View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Zerro Zerro is offline
external usenet poster
 
Posts: 2
Default macro

Why do none of these work for me.
I am using xp and Excel 2003

Sub CompareMacro()
Dim cell As Range
With Worksheets("Sheet1")
For Each cell In .UsedRange
If cell.Value = Worksheets("Sheet2").Range(cell.Address).Value
Then

The above line does not work

cell.Interior.ColorIndex = 5
Worksheets("Sheet2").Range(cell.Address).Interior. ColorIndex = 5
End If
Next cell
End With
End Sub

I have 2 workbooks open and renamed to suit above macro