PDA

View Full Version : Automatically Change Colour of Table Cell to Match Colour of Another Cell



GenuineGin
01-10-2015, 04:45 PM
Hello,

I'm trying to set the shading of a specific cell in a table to match that of the cell below. The cell below may be any colour so I can't specifically state the colour in the code.

I was thinking something along the lines of:

Dim LowerCellColour As Shading
LowerCellColour = ActiveDocument.Tables(1).Cell(5, 1).Shading

ActiveDocument.Tables(1).Cell(4, 1).Shading = LowerCellColour

Or something like that, but it doesn't work :(

Any advice?

gmaxey
01-10-2015, 08:35 PM
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
ActiveDocument.Tables(1).Cell(4, 1).Shading.BackgroundPatternColor = _
ActiveDocument.Tables(1).Cell(5, 1).Shading.BackgroundPatternColor
End Sub