+ Reply to Thread
Results 1 to 9 of 9

Highlight a (different) cell based on current active cell

  1. #1
    Registered User
    Join Date
    05-19-2012
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    5

    Highlight a (different) cell based on current active cell

    Hi - I've tried searching the forum and web for this without success.

    On the same sheet I have two data areas identical in size a1:o15 and a16:o30
    First area has data which I need to look at while moving through second area so ...
    I want to highlight the (logically) linked cell based on current cell (which will be in the second area).

    i.e. if I move into cell B18, I want cell B3 to change fill colour while I'm in the cell B18
    (then I move to D19 and want D4 highlighted etc).

    I've tried mucking around with conditional formatting and using CELL "address" with INDIRECT and ADDRESS but can't get close.
    As an intermediate step, I've got a Worksheet_SelectionChange sub updating a fixed cell with the current cell address but don't seem to be able to use that info.

    Would very much appreciate help
    Thanks, Ian

  2. #2
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Highlight a (different) cell based on current active cell

    Try this ...

    In the sheet module for your desired sheet
    Please Login or Register  to view this content.
    See this workbook
    Attached Files Attached Files
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  3. #3
    Registered User
    Join Date
    05-19-2012
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Highlight a (different) cell based on current active cell

    Hi - thanks for replying. On my sheet (and yours) that appears to be highlighting the row and column headings of the active cell i.e. A and 16 (say).
    The cell (not row and column heading) I need highlighted is the cell in the first range i.e. the 'offset' cell from the active cell.

    I may not have explained the issue properly as you have quickly come up with an answer I couldn't have arrived at - do I need to re-explain ??
    Help anyone ??
    Last edited by scamp53; 05-19-2012 at 09:33 PM.

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,598

    Re: Highlight a (different) cell based on current active cell

    Try this one:
    Attached Files Attached Files
    Ben Van Johnson

  5. #5
    Registered User
    Join Date
    05-19-2012
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Highlight a (different) cell based on current active cell

    Hi - is it possible I've got some setup that is affecting this. I've copied your code across and it appears to do nothing. As it's similar to the previous response, it must be something my end?
    I've tried substituting my range for 'LowerTable' and also naming the LowerTable range. I've also tried saving as xlsm, xls and xlsx.
    I can't get your Trail-it sheet to work either. Cells G8 and G23 appear to have green fill formatting fixed but if I move the active cell around the bottom table nothing happens.
    I'm starting to think I'm thick?
    Any thoughts about what I might be missing?

  6. #6
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Highlight a (different) cell based on current active cell

    Since both solutions offered so far are very similar, best post your workbook with an "active" cell and it's offset marked as you need.
    Disguise any sensitive data.

  7. #7
    Registered User
    Join Date
    05-19-2012
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Highlight a (different) cell based on current active cell

    Hi - good idea and thanks. No need to worry about sensitive data as you'll see :-)
    The (currently) active cell is G21 in the lowertable.
    The cell to be highlighted is G6 - i.e. this column, row -15

    Thanks again
    Attached Files Attached Files

  8. #8
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Highlight a (different) cell based on current active cell

    See if this does as you need.

    Note
    1/. Your conditional formatting will over-ride this code.
    2/. Multiple cells can be selected, highlighting multiple offsets.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    05-19-2012
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Highlight a (different) cell based on current active cell

    Thanks so much for continuing this. So it seems the problem is my conditional formatting. As I need to retain that, it seems I'll have to look at some other method of highlighting the cell using your selection method (borders, font?). I hope that's do-able - won't be able to revisit it for a day or so but looking forward to testing.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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