Colors in Cells....

M

Mario Manzano

Hi There!

Thank you in advanced for taking the time to read this.

We have some files that have to be colorful, long story
short.... How can we COPY a cell? I mean copy the value
and the color of it.

We know there is some VB code to get the color number of a
cell. But, how do we tell that cell to get the format or
color and the value, not just the value.

Any help or tips are highly appreciated!!

Best Regards.
 
C

Chip Pearson

Mario,

You can use the Copy method. E.g.,
Range("A1").Copy destination:=Range("D5")


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
M

Melanie Breden

Hi Mario,

Mario said:
Thank you in advanced for taking the time to read this.

We have some files that have to be colorful, long story
short.... How can we COPY a cell? I mean copy the value
and the color of it.

We know there is some VB code to get the color number of a
cell. But, how do we tell that cell to get the format or
color and the value, not just the value.

Any help or tips are highly appreciated!!

here are two possibilities:

Range("A1").Copy Range("C10")
----

Dim rngSource As Range
Dim rngTarget As Range

Set rngSource = Range("A1")
Set rngTarget = Range("D1")

With rngTarget
.Value = rngSource.Value
.Interior.ColorIndex = rngSource.Interior.ColorIndex
.Font.Color = rngSource.Font.Color
End With

--
Regards
Melanie Breden
- Microsoft MVP für Excel -

http://excel.codebooks.de (Das Excel-VBA Codebook)
 
G

Guest

Thank you !! very, very
much!!
-----Original Message-----
Mario,

You can use the Copy method. E.g.,
Range("A1").Copy destination:=Range("D5")


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com






.
 
Top