Hi,
Beyond new to VBA and macros. I'm trying to put together some simple code to loop through all sheets, excluding sheet 1, to format a varied range of cells in each sheet (if the cell has text, format it).
I've been reading through all the forums and it seems like it should be simple. But clearly not as simple as it seems....at least for someone like me.
code
Sub FormatSheets()
Dim WS As Worksheet
For Each WS In ThisWorkbook.Worksheets
If WS <> "Sheet1" Then
Range("A1:D1", Range("C1").End(xlToRight)).Interior.Color = rgbDarkMagenta
End If
Next
End Sub
/code
The best I can get is sheet 1, which I'm trying to exclude have its header formatted. The code loops through the other cells, but does not actually format them.
Any help would be greatly appreciated.
Thank you!
Beyond new to VBA and macros. I'm trying to put together some simple code to loop through all sheets, excluding sheet 1, to format a varied range of cells in each sheet (if the cell has text, format it).
I've been reading through all the forums and it seems like it should be simple. But clearly not as simple as it seems....at least for someone like me.
code
Sub FormatSheets()
Dim WS As Worksheet
For Each WS In ThisWorkbook.Worksheets
If WS <> "Sheet1" Then
Range("A1:D1", Range("C1").End(xlToRight)).Interior.Color = rgbDarkMagenta
End If
Next
End Sub
/code
The best I can get is sheet 1, which I'm trying to exclude have its header formatted. The code loops through the other cells, but does not actually format them.
Any help would be greatly appreciated.
Thank you!