+ Reply to Thread
Results 1 to 6 of 6

Highlighting row and column of selected cell - revisited

  1. #1
    Registered User
    Join Date
    09-18-2009
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2010
    Posts
    20

    Highlighting row and column of selected cell - revisited

    Hi all,

    I refer to this previous thread:

    http://www.excelforum.com/excel-gene...cted-cell.html

    The solution works really well however it clears any existing colors in cells eg column headings, etc.

    Is there a way around this?

    Regards,

    Chris.

  2. #2
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: Highlighting row and column of selected cell - revisited

    Okay - slightly different approach using transparent shapes. Note, the code is specific to shapes(1) and shapes(2). You may need to change the code if you start at a different point, or just use this as your starting spreadsheet and it should continue to work. Here is the code:
    Please Login or Register  to view this content.
    It should work with more than one cell selected, as long as the cells are contiguous. The problem I have with it is that if you select a cell within the shapes, then the shape becomes selected. You could counter this by adding this code:
    Please Login or Register  to view this content.
    but it still does not allow a cell in the highlight to be selected.ActiveHighlight.xlsm
    Pauley
    --------
    If I helped with your issue, I'd appreciate a rep bump (hit the '*' icon to the bottom left of this post).

  3. #3
    Registered User
    Join Date
    09-18-2009
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Highlighting row and column of selected cell - revisited

    Thanks Pauley.

    This works as requested.

    However id only allows 1 step of undo, and does not allow copy/cut and paste.

    Also if I copy the code into my spreadsheet which has conditional formatting the code stops at Shapes(2).Top = Target.Top

    Maybe I am asking too much.

    Thanks for your help though, I will keep searching.

    Chris.

  4. #4
    Registered User
    Join Date
    09-18-2009
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Highlighting row and column of selected cell - revisited

    I have found this page and my answer.

    http://www.tushar-mehta.com/publish_...d%20cell.shtml

    The combination of VBA and conditional formatting works.

    Thanks,

    Chris.

  5. #5
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: Highlighting row and column of selected cell - revisited

    Thanks for sharing what you found. Definitely a cleaner approach. The Undo issue does not surprise me (event handlers sometimes cause that), but I don't know why it would prevent copy and paste (it works for me). As for the code stopping, that is probably because you did not create the rectangle shapes (i.e. the shapes are needed, too, not just the code). As I said, the code is specific to Shapes(1) and Shapes(2). Regardless, much better solution found.

    Pauley

  6. #6
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Highlighting row and column of selected cell - revisited

    Great Code Pauley. I don't address the UNDO issue which is a completely different animal.

    See the attached code and sample workbook that addresses the issue of selecting a cell in Shape(1) or Shape(2). The code is a lot more complicated than I originally anticipated.

    In the Sheet Module:
    Please Login or Register  to view this content.
    In ordinary code module ModCellHighlighting. This is the code based on Pauley's original code.
    Please Login or Register  to view this content.
    In ordinary code module ModScreenFormatting. I put all this code in a separate module because it contains general support routines and because it contains low level interface calls to the Microsoft API (Application Programmer's Interface):
    Please Login or Register  to view this content.
    Lewis

+ 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] Selected cell highlighting has vanished...no shading now.
    By JR1 in forum Excel General
    Replies: 11
    Last Post: 07-20-2022, 12:40 AM
  2. Replies: 7
    Last Post: 12-17-2013, 02:40 PM
  3. Highlighting selected cells in column B and C
    By chrisjack in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-05-2012, 04:36 PM
  4. Highlighting Cell When Selected for x Number of Seconds
    By btdmartin in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-22-2012, 09:56 AM
  5. Selected Cell Highlighting
    By boylejob in forum Excel General
    Replies: 3
    Last Post: 08-05-2010, 04:04 PM
  6. Highlighting a Row when a cell is selected
    By julvaz in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-18-2007, 02:56 AM
  7. RE: Selected cell highlighting has vanished...no shading now.
    By Brymor in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-06-2006, 11:50 AM
  8. Highlighting the selected row or column
    By Lewis Clark in forum Excel General
    Replies: 4
    Last Post: 05-02-2005, 09:06 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