Results 1 to 3 of 3

Highlight active cell or range for visiblity purposes.

Threaded View

redsab Highlight active cell or... 10-05-2020, 03:30 PM
redsab Re: Highlight active cell or... 10-05-2020, 03:37 PM
redsab Re: Highlight active cell or... 10-06-2020, 12:15 PM
  1. #1
    Forum Contributor
    Join Date
    05-02-2013
    Location
    Indiana
    MS-Off Ver
    Microsoft 365 (Subscription)
    Posts
    192

    Highlight active cell or range for visiblity purposes.

    Hello, I am having difficulty get this macro to work correctly, does anyone see my problem? I would like to high light the active cell yellow (or range) when I click on it or arrow to a cell. Then when I move off of the cell, I would like to restore its original attributes. It seems I would record the original attributes, highlight it yellow, and when I move off the cell restore the attributes. The code changes the cell yellow; however, it does not restore the original color. I have a few lines of code I have messaged out because they do not work. I would appreciate any help you could give me. Thanks Redsab
    Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Excel.Range)
        Static xLastRng As Range
        Dim SaveColor As Long
    
        On Error Resume Next
    
       'SaveColor = ActiveCell.Interior.Color
        
       Target.Interior.ColorIndex = 6
       xLastRng.Interior.ColorIndex = SaveColor  'xlColorIndexNone
       Set xLastRng = Target
        
       'ActiveCell.Interior.Color = SaveColor
    
    End Sub
    Last edited by redsab; 10-06-2020 at 12:16 PM. Reason: Add excel sheet

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] If active cell value dosn't match in range then highlight the active cell
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-18-2017, 12:38 AM
  2. Highlight active cell
    By calsam1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-25-2016, 11:24 AM
  3. [SOLVED] Highlight active cell, un-highlight when no longer active?
    By cdterry in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-20-2013, 02:39 PM
  4. Highlight Active Row macro, and Bold the Active Cell
    By StudentTeacher in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-08-2013, 07:43 PM
  5. [SOLVED] How to highlight an active row within a selected range in excel
    By jjin in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-05-2013, 08:52 PM
  6. highlight the active row in a range
    By haplo39 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-17-2007, 06:30 AM
  7. Highlight active range?
    By Gordon in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-18-2005, 01:55 PM

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