For Loop goes thru all sheets but doesn't execute code?
I'm sure I'm just not seeing the forest for the trees - this should be so simple....
I just want to change the color of the blue cells to white. I need to loop through all used ranges of all worksheets. The code I have is going through all the sheets, but it only executes the code on the specific worksheet that's active when I run the macro. What am I missing?
Code:
Sub ChangeColor()Dim ws As Worksheet
Dim cell As Range
Dim rng As Range
Set rng = Range("A1:aj200")
Set ws = Application.ActiveSheet
For Each ws In Worksheets
ws.Activate
For Each cell In rng
If cell.Interior.ColorIndex = 23 Then
cell.Interior.ColorIndex = 2
cell.Font.ColorIndex = 56
End If
Next cell
Next ws
End Sub