shading alternate rows

J

Jackie D

Hi

I have a table with four columns and several rows. I want to shade each
alternate row. I am manually shading at the moment. Is there a way I can
speed it up by copying and pasting the shaded rows?
 
D

Doug Robbins - Word MVP

Running a macro containing the following code will apply shading to
alternate rows of the table in which the selection is located:

Dim i As Long
Dim atable As Table
Set atable = Selection.Tables(1)
With atable
For i = 2 To .Rows.Count Step 2
.Rows(i).Shading.BackgroundPatternColor = wdColorGray05
Next i
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
T

Tony Jollans

It depends a bit on what version of Word you have but take a look at Table >
AutoFormat to set up a striped table.
 
J

Jackie D

Thank you, Doug
--
Jackie D


Doug Robbins - Word MVP said:
Running a macro containing the following code will apply shading to
alternate rows of the table in which the selection is located:

Dim i As Long
Dim atable As Table
Set atable = Selection.Tables(1)
With atable
For i = 2 To .Rows.Count Step 2
.Rows(i).Shading.BackgroundPatternColor = wdColorGray05
Next i
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
S

Suzanne S. Barnhill

In Word 2002 and 2003, you also have access to table styles (the successor
to AutoFormats, they can be user-defined), and row striping is one of the
properties you can define in the style. Although table styles are flaky in
other ways (see http://www.shaunakelly.com/word/tablestyles/index.html),
they can be extremely helpful when you need alternate row shading.
 
J

Jackie D

Thanks Suzanne. I'll have a play!
--
Jackie D


Suzanne S. Barnhill said:
In Word 2002 and 2003, you also have access to table styles (the successor
to AutoFormats, they can be user-defined), and row striping is one of the
properties you can define in the style. Although table styles are flaky in
other ways (see http://www.shaunakelly.com/word/tablestyles/index.html),
they can be extremely helpful when you need alternate row shading.
 

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