View Single Post
  #4   Report Post  
Posted to microsoft.public.word.tables
Doug Robbins - Word MVP on news.microsoft.com Doug Robbins - Word MVP on news.microsoft.com is offline
external usenet poster
 
Posts: 407
Default How do I change a table cell color globally?

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

"Richard Morey" wrote in message
...
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

"Doug Robbins - Word MVP on news.microsoft.com"
wrote in message ...
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/Macros...eateAMacro.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

"CA_stateworker" wrote in
message ...
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
--
stateworker