Old Macros have an evidently simple problem
Posted by Sukant Hajra on November 07, 2001 6:41 AM
Okay,
Before, I was banking on "Rows" and "Columns" being collections of Objects called "Row" and "Colomn" but I think that changed in Excel 2000. Well. . . I can't say really. All I know is that the simple macro used to work in an earlier version of Excel, but it doesn't work in 2000.
I really think the problem is with the way I'm using for each, and Excel is set up not to mandate variable declaration.
Please respond with any help to my E-mail, Sukant.Hajra@motorola.com.
Thanks,
Sukant
Sub AlternateOnChange()
Dim Toggle As Boolean
Dim iSect As Range
Set iSect = Application.Intersect(ActiveSheet.UsedRange, Selection)
Toggle = True
For Each r In iSect.Rows
If Toggle = True Then
r.Interior.Color = RGB(210, 210, 210)
Else
r.Interior.Color = RGB(255, 255, 200)
End If
If r.Cells(1, 1) <> r.Cells(2, 1) Then
Toggle = Not Toggle
End If
Next r
End Sub