I currently use the following macro to highlight alternating rows based on the cell that is selected when I run the macro:
Sub HighlightAltRows()
ActiveCell.Select
Do
If IsEmpty(ActiveCell.Value) Then
Range(“A1”).Select
Exit Sub
Else
Range(ActiveCell.End(xlToRight), ActiveCell).Select
With Selection.Interior
.ColorIndex = 36
.Pattern = xlSolid
End With
ActiveCell.Offset(2, 0).Select
End If
Loop
End Sub
However, if a row contains columns without data, then the higlighting for that rows ceases and leaves the remainder of the row unhighlighted. How can I modify this macro to determine how many columns with data are present in the row of the cell selected and then use this to make the highlighted rows the same length? (basically the row from the cell selected will have data in all of the columns) I want the highlighting to be this number of rows wide until the macro encounters a row that is blank.
Thanks in advance for any assistance.