How do I change a table cell color globally?

C

CA_stateworker

I have a table with color coded cells. I would like to change all the green
cells to a different color. Is there anyway I can change all the green cells
globally or do I have to select and change the color of each cell
individually?

Thank you
 
D

Doug Robbins - Word MVP on news.microsoft.com

Run a macro containing the following code when the cursor is in the table

Dim i As Long
Dim j As Long
With Selection.Tables(1)
For i = 1 To .Rows.Count
For j = 1 To .Columns.Count
With .Cell(i, j).Shading
If .BackgroundPatternColorIndex = wdGreen Then
.BackgroundPatternColorIndex = wdRed
End If
End With
Next j
Next i
End With

See the article "What do I do with macros sent to me by other newsgroup
readers to help me out?" at:

http://www.word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm


--
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, originally posted via msnews.microsoft.com
 
R

Richard Morey

Hi --

I would like to do something similar with 30 tables in a document, but I
want to change the table width so that column 1 is 1.25" and column 2 is
4.75".

Can you offer me a simple way to accomplish this?

Thanks

Rich
 
D

Doug Robbins - Word MVP on news.microsoft.com

Dim i As Long
With ActiveDocument
For i = 1 To .Tables.Count
With .Tables(i)
.Columns(1).Width = InchesToPoints(1.25)
.Columns(2).Width = InchesToPoints(4.75)
End With
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, originally posted via msnews.microsoft.com
 

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