ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Colors in Cells.... (https://www.excelbanter.com/excel-programming/298968-colors-cells.html)

Mario Manzano

Colors in Cells....
 
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.

Chip Pearson

Colors in Cells....
 
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



"Mario Manzano" wrote in message
...
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.




Melanie Breden

Colors in Cells....
 
Hi Mario,

Mario Manzano wrote:
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)


No Name

Colors in Cells....
 
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



"Mario Manzano" wrote in

message
...
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.



.


No Name

Colors in Cells....
 
Melanie,

Thank you for your kindness!!


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

Mario Manzano wrote:
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)

.



All times are GMT +1. The time now is 08:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com