+ Reply to Thread
Results 1 to 4 of 4

Excel 2007 : How to make a cell chnage it's background after every click?

  1. #1
    Registered User
    Join Date
    12-12-2009
    Location
    Islamabad, Pakistan
    MS-Off Ver
    Excel 2007
    Posts
    4

    How to make a cell chnage it's background after every click?

    Hi Friends,
    I want an active cell to change it's background color every time it is clicked... For example, I would want cell (G9) to change it's color in following manner:
    First Click... Green
    Second Click... Red
    Third Click... Some Pattern
    4th Click... No formatting
    5th Click... Green
    .
    .
    .

    and the sequence must repeat like this... I would be thankful if someone could help me on this...

  2. #2
    Forum Contributor
    Join Date
    12-02-2009
    Location
    Akron, Ohio
    MS-Off Ver
    Excel 2010
    Posts
    208

    Re: How to make a cell chnage it's background after every click?

    You could try this. If you need the number of clicks to be saved when the workbook closes then you'd have to save a counter.

    Please Login or Register  to view this content.
    Use the macro recorder and get the exact pattern that you want to use and substitute it into the Select Case. You could also put this in the DoubleClick Event if you wanted to.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    12-12-2009
    Location
    Islamabad, Pakistan
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: How to make a cell chnage it's background after every click?

    Thanks for your help mate

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How to make a cell chnage it's background after every click?

    This approach will work in any number of cells at the same time. Just change the "G9" reference to any list of cells or ranges you wish. It evaluates the cell's current color and decides where to go next based on that.
    Please Login or Register  to view this content.
    NOTE: This is the normal double-click left button, not the right-click.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ 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