ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   color multiple rows (https://www.excelbanter.com/excel-programming/427636-color-multiple-rows.html)

bernd

color multiple rows
 
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

Per Jessen[_2_]

color multiple rows
 
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

On 28 Apr., 15:43, bernd wrote:
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



bernd

color multiple rows
 
This is exactly how I meant it.

Thank you Per!


All times are GMT +1. The time now is 03:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com