dynamically copy cell content and fill color

J

John Keith

I know I can easily copy the contents of cell S1 to cell A1 by simply
putting =S1 into cell A1, but can I also copy the fill color and
content from S1 to A1 using some function?

TIA


John Keith
(e-mail address removed)
 
G

Gord Dibben

John

Without code you are stuck with Copy>paste special>paste links then paste
special>Formats.

Unless S1 has conditional formatting for fill color.

You could copy that CF to A1


Gord Dibben MS Excel MVP
 
J

John Keith

Without code you are stuck with Copy>paste special>paste links then paste
special>Formats.

Unless S1 has conditional formatting for fill color.

You could copy that CF to A1

Thanks for the quick reply!

The fill color is not CF, rather it is explicitly set.

What would code look like to copy contents and fill color for 5
adjacent cells in the same column?


John Keith
(e-mail address removed)
 
G

Gord Dibben

Something like this...........

Sub Macro6()
Selection.Copy
Range("H6").Select
ActiveSheet.Paste Link:=True
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
End Sub


Gord
 
J

John Keith

Something like this...........

Sub Macro6()
Selection.Copy
Range("H6").Select
ActiveSheet.Paste Link:=True
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
End Sub


Gord

I'll play with this. I need to understand a couple of things:

"H6" is a named range that is the source of the copy?

Where is the destination of the copy specified?

Someday I've got to figure out how to determine what goes into a
routine like this.
John Keith
(e-mail address removed)
 
G

Gord Dibben

Selection is the selection to copy.

H6 is the copy destination.

Most of this was picked up by the Macro Recorder.


Gord
 

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