Formatting Alternating Rows with a Color

D

Daren

Hello,

Is there a macro or quick way to highlight alternating rows in color? For
example, row 1 would be gray, row 3 would be gray, row 5 would be gray, etc.

Thanks.
 
P

Pete_UK

Use Conditional Formatting, with a Formula like:

=MOD(ROW(),2)=1

then set the background colour (Patterns tab) to grey.

Hope this helps.

Pete
 
M

Mike H

Hi,

Select the rows you want to format in this way then

Format|Conditional Format
Select formula is and enter the formula
=MOD(ROW(),2)=1

Pick your colour
Click OK

Mike
 
D

Daren

Thanks, that worked well.

Mike H said:
Hi,

Select the rows you want to format in this way then

Format|Conditional Format
Select formula is and enter the formula
=MOD(ROW(),2)=1

Pick your colour
Click OK

Mike
 
D

Daren

Thanks!

Pete_UK said:
Use Conditional Formatting, with a Formula like:

=MOD(ROW(),2)=1

then set the background colour (Patterns tab) to grey.

Hope this helps.

Pete
 
G

Gord Dibben

Daren

Pete's formula won't survive through filtering if you intend to do any.

This will keep alternate row colors even when filtering.

=MOD(SUBTOTAL(3,$A1:$A$2),2)=0


Gord Dibben MS Excel MVP
 
L

~L

This formula comes unhinged if there are any blank rows. Adjust the range to
the start of the data and make sure the data is continuous if this fails.
 
G

Gord Dibben

Good point.


Thanks, Gord

This formula comes unhinged if there are any blank rows. Adjust the range to
the start of the data and make sure the data is continuous if this fails.
 

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

Top