highlight alternate row in excel

  • Thread starter Thread starter gopal
  • Start date Start date
G

gopal

Dear Friends,

i would like to have a command or vba-code for highlighting alternate
row.
e.g. a1..h1, a3...h3, a5...h5, a7...h7

thanks
 
here is some code that will do what you want

Sub banding()
Dim i As Long
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
For i = 1 To 5 Step 2
ws.Range("A" & i & ":H" & i).Interior.ColorIndex = 37
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top