简体   繁体   中英

I want to change color of text in one cell based on the color of text in another cell

I want a VBA program to change the color of text in one cell based on the color of text in another cell. For example:

If the color of text in cell A1 is blue. I want the color of text in cell B1 to be blue.

A formula or VBA program would help as I would need to do the same for a large number of cell.

Use Font.Color property of specified cells.

Range("B1").Font.Color = Range("A1").Font.Color

Also you can use any variable for reusing.

Dim ColorTemplate As Long = Range("A1").Font.Color
Range("B1").Font.Color = ColorTemplate
Range("C1").Font.Color = ColorTemplate
...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM