color multiple rows

  • Thread starter Thread starter bernd
  • Start date Start date
B

bernd

Hi,

Can someone help me out with the following problem:

In comlumn A the macro has to look for the value "0".
Everytime this value is found this row and the row below have to be
coloured.

Someone?

Thank in advance.

Bernd
 
Hi

Try this:

Sub ColorRows()
FirstRow = 1
LastRow = Range("A" & Rows.Count).End(xlUp).Row
For r = FirstRow To LastRow
If Cells(r, "A").Value = "0" Then
Rows(r).Resize(2).Interior.ColorIndex = 6
End If
Next
End Sub

Best regards,
Per
 

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