+ Reply to Thread
Results 1 to 7 of 7

Changing colour of cell when adjacent cell is selected.

  1. #1
    Forum Contributor
    Join Date
    01-18-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    641

    Changing colour of cell when adjacent cell is selected.

    I'm trying to affect the colour of a cell in J3:J14 range when the adjacent cell in K3:K14 is selected.

    The cells and contents in J3:J14 are formatted to be white. When the equivalent cell in K3:K14 is selected this would change to dark blue , and back to white when the selection is changed.

    For example : I select K5 , and J5 changes from white to dark blue. When I click away , it changes back to white.

    Can someone advise some event code to satisfy this?

    Grateful for any advice.

    Last edited by CDandVinyl; 09-04-2022 at 12:40 AM.
    Using Excel , Word and Access 2003 - For the whole of 2024

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,527

    Re: Changing colour of cell when adjacent cell is selected.

    Hi there,

    Try this event macro on the sheet (i.e. do not copy into a standard module) in question:

    Please Login or Register  to view this content.
    Not sure if you wanted this way but the entire range fill J3:J14 is cleared whenever you click outside the range K3:14.

    Regards,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  3. #3
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,882

    Re: Changing colour of cell when adjacent cell is selected.

    Try:
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  4. #4
    Forum Contributor
    Join Date
    01-18-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    641

    Re: Changing colour of cell when adjacent cell is selected.

    OK thanks. I'm grateful for your help.


    As an extra thing , how could the code be modified to change the font colour (from white to blue , and back again), rather than the cell fill?

  5. #5
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,882

    Re: Changing colour of cell when adjacent cell is selected.

    Try:
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    01-18-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    641

    Re: Changing colour of cell when adjacent cell is selected.

    That's great - all working fine. Much appreciated.


  7. #7
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,882

    Re: Changing colour of cell when adjacent cell is selected.

    You are very welcome.

+ 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] Changing text colour in a cell based on value or colour of another cell.
    By Jeankartel in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 08-15-2019, 07:16 PM
  2. [SOLVED] format a cell background colour based on a manual background colour of an adjacent cell
    By Nampara in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-24-2018, 04:03 PM
  3. [SOLVED] Macro to change text colour of adjacent cell to the same text colour as target cell
    By kayoke in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 06-28-2012, 04:18 AM
  4. Replies: 1
    Last Post: 12-08-2011, 09:15 AM
  5. Replies: 2
    Last Post: 06-07-2011, 07:00 AM
  6. changing a cell depending on the fill colour of adjacent cells
    By debbiec in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-21-2009, 06:11 AM
  7. changing colour of selected cell
    By samg27 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-16-2008, 08:35 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