Computing.Net > Forums > Office Software > Excel button to change cell colour

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Excel button to change cell colour

Reply to Message Icon

Name: lee123abc
Date: August 4, 2009 at 05:46:29 Pacific
OS: win xp 5.1.2600
CPU/Ram: 3mhz/2 gig
Product: Dell / PRECISION
Subcategory: Microsoft Office
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: DerbyDad03
Date: August 4, 2009 at 06:15:09 Pacific
Reply:

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")


0

Response Number 2
Name: lee123abc
Date: August 4, 2009 at 06:24:45 Pacific
Reply:

Thank you DerbyDad03

That is exactly what I needed.
Cheers


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Office Software Forum Home


Sponsored links

Ads by Google


Results for: Excel button to change cell colour

excel formula to change cell addres www.computing.net/answers/office/excel-formula-to-change-cell-addres/5899.html

Change cell color in Excel www.computing.net/answers/office/change-cell-color-in-excel/9540.html

excel macro to change sheets www.computing.net/answers/office/excel-macro-to-change-sheets/2864.html