background shading

P

Pammy

Is there a way to copy background shading? I have a table set up with 9
different rows and I have shaded each row with a different color. But I
cannot copy the background format. Is there a way to do this?
 
S

Stefan Blom

Helmut Weber has posted this reply:

**********
I couldn't find a way other than to record the source color,
select the target cells afterwards,
and apply the recorded color.

Of course, some vba-knowledge is essential.

Option Explicit
Dim lngColor As Long ' global for module
' -------------------------------
Sub GetColor()
lngColor = Selection.Cells(1).Shading.BackgroundPatternColor
End Sub
' -------------------------------
Sub SetColor()
Selection.Cells.Shading.BackgroundPatternColor = lngColor
End Sub

You may assign the macros to convenient shortcuts.

The value of lngColor might not stay defined forever,
depending on what you do between getcolor and setcolor.
**********
 

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