Hi!
I have an Excel book with more than 30 sheets. I want to shade rows alternately to blue and white colors, starting on row 6 till the last row containing data, but only applied to columns from A to O and excepting sheets named "Protection" and "Help". Also, I want to know where to place the code.
I need a code from scratch you might suggest or you to correct the ones I show below.
Code 1 to be corrected
I have an Excel book with more than 30 sheets. I want to shade rows alternately to blue and white colors, starting on row 6 till the last row containing data, but only applied to columns from A to O and excepting sheets named "Protection" and "Help". Also, I want to know where to place the code.
I need a code from scratch you might suggest or you to correct the ones I show below.
Code 1 to be corrected
VBA Code:
Sub TwoColorsForRangeOfRowsAndColumns()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim LastRow As Long
LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
Dim x As Long
For x = 6 To LastRow Step 2
Range(Cells(x, 1), Cells(x, 15)).Interior.ColorIndex = 20
Next x
For x = 7 To LastRow Step 2
Range(Cells(x, 1), Cells(x, 15)).Interior.ColorIndex = 2
Next x
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
Last edited by a moderator: