+ Reply to Thread
Results 1 to 6 of 6

Change colour of a cell when it's clicked, change when it's clicked again.

  1. #1
    Forum Contributor
    Join Date
    06-14-2013
    Location
    jk
    MS-Off Ver
    Excel 2007
    Posts
    326

    Change colour of a cell when it's clicked, change when it's clicked again.

    Dear guru's,

    I would like to use your suggestions for the following.

    I have a basic calendar from excel-template.
    The macro should change the color of a cell to green when the content inside of that cell is clicked. When clicked again it should change the color of the cell to red. When another click is done it should format it to empty again.

    So to get the idea the calender is marked.

    My idea was to use hyperlinks in the cells to activate macro's. But i don't know if there are any easier examples.

    Do you guys have any better suggestions?
    Thanks a lot for your help,

    Regards.
    Crispy85

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Change colour of a cell when it's clicked, change when it's clicked again.

    Record yourself formatting the colours, then look at the code, thats the 1st bit done, then you can use an if statement based on what you have

    so
    Please Login or Register  to view this content.

    Recording standard excel functions will give you a great insight into coding
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Change colour of a cell when it's clicked, change when it's clicked again.

    Maybe:

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    06-14-2013
    Location
    jk
    MS-Off Ver
    Excel 2007
    Posts
    326

    Re: Change colour of a cell when it's clicked, change when it's clicked again.

    Thanks for your help guys!! I'll work on it tonight!

    Regards,
    Crispy

  5. #5
    Forum Contributor
    Join Date
    06-14-2013
    Location
    jk
    MS-Off Ver
    Excel 2007
    Posts
    326

    Re: Change colour of a cell when it's clicked, change when it's clicked again.

    Hi all,

    I tried something with the help of you and internet.
    Please find my workbook attached.

    the workbook has 2 years (2014 & 2015).
    The script works, but only for january 1st till january 11th.

    In the year 2015 it doesn't work at all.
    Can you see what i'm doing wrong in this code?

    Thanks for all the help, i appreciate it.

    Regards,
    Crispy85
    Attached Files Attached Files

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Change colour of a cell when it's clicked, change when it's clicked again.

    Hi Crispy85

    Your Cells (other than january 1st till january 11th) appear to have a Color Index of 2...change that to No Color.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Need to change cell contents when clicked
    By snapajap in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-06-2013, 02:11 AM
  2. change button colour when clicked
    By Bonnister in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-14-2012, 02:46 AM
  3. How to change active cell after hyperlink clicked
    By Launchnet in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 12-28-2009, 02:29 PM
  4. Programming Excel to change colour of cells when clicked
    By Stella Artois in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-04-2007, 11:39 PM
  5. Change cell value when right-clicked/double-clicked
    By grime in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-17-2005, 09:05 AM

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