copy colour

A

assaf1978

Hi,
How can I copy a colour of a cell to another cell, using a function or a
macro?

Thanks,
Assaf.
 
S

Sheeloo

Try

Sub CopyColor()
Range("B2").Select
With Selection.Interior
.Pattern = Range("A2").Interior.Pattern
.Color = Range("A2").Interior.Color
End With
End Sub
 
T

TomPl

If you are familiar with VBA (Macros) the following code will copy the color
of F7 to A1 on the active worksheet:

Sub copycolor()

ActiveSheet.Range("A1").Interior.ColorIndex =
ActiveSheet.Range("F7").Interior.ColorIndex
ActiveSheet.Range("A1").Interior.Pattern =
ActiveSheet.Range("F7").Interior.Pattern

End Sub

If you are not familiar with VBA then more information about what you are
trying to do would be necessary.

Tom
 
G

Gord Dibben

Functions cannot change formatting of a cell so it must be a macro.

Sub colorit()
ActiveCell.Interior.ColorIndex = _
Range("A1").Interior.ColorIndex
End Sub

Or use the Format PaintBrush


Gord Dibben MS Excel MVP
 

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