Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to print Excel spreadsheet with alternating row colors

Status
Not open for further replies.

klm2klm2

Programmer
Dec 24, 2002
36
US
Does anybody know how to print an Excel spreadsheet so that the rows have alternating colors? e.g. First row, light blue. Second row, no color. Third row, light blue. etc.

Thanks!
 
Highlight the entire row you want to have a colored background by clicking on the actual row number (not the first cell). This will highlight (make active) the entire row. Click on the down arrow next to the "fill color" paint bucket in the toolbar at the top of the monitor. If the "fill color" paint bucket is not there, click on "view" in the top left corner menu, then click "toolbars" and then click on "formatting". The tooltip will read "fill color" when you let the tip of your pointer rest on the paint bucket a few seconds. Once you have selected the color you want, all you have to do is select each row you wish to add background color and click on the paint bucket (not the arrow next to the paint bucket). You will probaly have to add borders to the cells so while the row is highlighted you can click on the borders icon down arrow on the tool bar, select the icon that shows borders around all cells, and then click on the borders icon for each row to which you add a color background. I like to add borders to all cells in my spreadsheet so I highlight all the cells for which I want to add bordes and hit the borders icon one time.

You can also right click on the row number, choose format cells, choose patterns, choose the color you wish, choose borders, select the different border patterns that work for you (just click on the lines in the pattern box on the screen - click once it puts a lign in and click again and it takes it out (toggles on and off).

You will be highlighting a row and applying background color to the entire row, not just your cells, but that is typically not a problem. If it is, let me know.
 
Here's a routine I've put together...


Sub Color_EverySecondRow()
'<<< insert your print range here >>>
For i = 1 To Selection.Rows.Count / 2
ActiveCell.EntireRow.Select
Selection.Interior.ColorIndex = 6
ActiveCell.Offset(2, 0).Activate
Next
End Sub

Hope this helps. :)

Regards, ...Dale Watson dwatson@bsi.gov.mb.ca

 
Dale,

What triggers the routine that you wrote?

Thanks,
Kim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top