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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting Tables in Word 97 1

Status
Not open for further replies.

Spott

Technical User
Mar 11, 2002
21
0
0
US
Hi,

I'm "graybarring" tables in word to make them easier to read online. None of the auto formats do what I want exactly and they don't auto-adjust if I add or delete rows. I just want gray, white, gray, white. I can format this in excel using conditional formatting and formula is=MOD(ROW(),2)=0 and set my cell to be gray. This adjusts for added or deleted cells.

Any ideas for word?

Thanks,
Spott
 
Here is a macro to do what you need:

Odd number rows shaded grey:
Dim rw As Row
For Each rw In ActiveDocument.Tables(1).Rows
If rw.Index Mod 2 = 1 Then
rw.Shading.Texture = wdTexture10Percent
End If
Next rw

Even number rows shaded grey:
Dim rw As Row
For Each rw In ActiveDocument.Tables(1).Rows
If rw.Index Mod 2 = 0 Then
rw.Shading.Texture = wdTexture10Percent
End If
Next rw

 
I need to work at it (I'm of the macro clueless) but I think this will do the trick. I somehow got it to work on the wrong table, undid it and killed the macro and couldn't get it to apply to any more tables in the document. I'll look through help and faq's and see if I can figure it out.

Thanks so much for the quick response. I knew this was the place to go!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top