Excel button to change cell colour

Dell PRECISION
August 4, 2009 at 05:46:29
Specs: win xp 5.1.2600, 3mhz/2 gig
Hi, I want to change cell A2 colour to equal cell A1 colour when I click a button.

I have a button and need the code please!
What I have already to change the value is:
range("a2").value = range("a1").value
This changes the value in the cell. (I just need the colour to change as well.

Thank you.
Lee


See More: Excel button to change cell colour

Report •


#1
August 4, 2009 at 06:15:09
To answer your specific question, the code to make the fill colors the same is:

Range("A2").Interior.ColorIndex = Range("A1").Interior.ColorIndex

Another option is to simply copy/paste the cell which will copy the value and all formating in one line:

Range("A1").Copy Destination:=Range("A2")


Report •

#2
August 4, 2009 at 06:24:45
Thank you DerbyDad03

That is exactly what I needed.
Cheers


Report •

Related Solutions


Ask Question