• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Showing named range on hover-over

Gregg Wolin

Member
I'd like to create a macro (or procedure that is always running) that will, on mouse hover, show the name of the range that the cell being hovered-over is a part (and maybe the comment from the Name Manager if any). If its not part of a named range, nothing would show up. I attached a screenshot mockup of what i had in mind.

Thanks in advance!
 

Attachments

  • vba-namepopup.PNG
    vba-namepopup.PNG
    35.8 KB · Views: 5
There really isn't reliable/clean way to trigger code on mouseover on cell. As there is no official MouseOver event.

You could use invisible ActiveX object, but would be difficult to make it dynamic.

In general, I'd recommend just using SelectionChange event to trigger things.

Ex: Using msgbox.
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim nRange As Name
For Each nRange In ThisWorkbook.Names
    If Not Intersect(Target, Range(nRange.RefersTo)) Is Nothing Then
        MsgBox ("Belongs to:" & nRange.Name & vbNewLine & nRange.Comment)
    End If
Next
End Sub

If you need further help. Please upload sample workbook.
 
Last edited:
Back
Top