Colors in Cells....

  • Thread starter Thread starter Mario Manzano
  • Start date Start date
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.
 
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
 
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)
 
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






.
 
Melanie,

Thank you for your kindness!!

-----Original Message-----
Hi Mario,



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)

.
 

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

Back
Top