+ Reply to Thread
Results 1 to 6 of 6

Change cell color on click

  1. #1
    Registered User
    Join Date
    02-18-2006
    Location
    WV
    MS-Off Ver
    2003,2007,2010
    Posts
    79

    Change cell color on click

    Hello, I have a grid of 22 X 22 squares that are white with a black border. Is there a way I can have a cell change to light yellow with a red border if clicked in and if clicked in again it would change back to white with black border. I needed to do this for several cells within the 22 X 22 cells. How can this be done?

    Thanks,
    Chad

  2. #2
    Registered User
    Join Date
    02-18-2006
    Location
    WV
    MS-Off Ver
    2003,2007,2010
    Posts
    79

    Re: Change cell color on click

    Well I found the code below but I would also like to change the borders if I could... How could I do that? Thanks!

    Please Login or Register  to view this content.

  3. #3
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Change cell color on click

    Not knowing which Excel version you're using (please update your profile!), you can find out the code to set the border of a cell to red by switching on the macro recorder, formatt a cell's border to red, switch off the macro recorder and study the code generated.

    hth

  4. #4
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Change cell color on click

    Simple addition to your code
    Please Login or Register  to view this content.
    Looking for great solutions but hate waiting?
    Seach this Forum through Google

    www.Google.com
    (e.g. +multiple +IF site:excelforum.com/excel-general/ )

    www.Google.com
    (e.g. +fill +combobox site:excelforum.com/excel-programming/ )

    Ave,
    Ricardo

  5. #5
    Registered User
    Join Date
    02-18-2006
    Location
    WV
    MS-Off Ver
    2003,2007,2010
    Posts
    79

    Re: Change cell color on click

    Awesome just what I was looking for.... Thanks rwgrietveld!

  6. #6
    Registered User
    Join Date
    02-18-2006
    Location
    WV
    MS-Off Ver
    2003,2007,2010
    Posts
    79

    Re: Change cell color on click

    rwgrietveld, I have another question. If I clicked on a square/cell how could I get it to color a 4 X 4 cell area "8 cells all together" with the cell that was clicked being the bottom left cell? Thanks!

    I attached what I have so far.....
    Attached Files Attached Files
    Last edited by oxicottin; 01-03-2010 at 02:42 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1