If Cursor = ??

P

PW11111

Hi,

I need a some help with the following.

I have 3 cells A1, A2, A3.
I have a detail cell B5
I need to display a differing message in B5 - depending on if the cursor is
hovering over either A1, A2, A3.
I think I need the code that says - if cursor = A1 then display "Hello A1".
or if cursor = A2 then display "Hello A2".

I hope this makes sense - any help would be great.

Phil
 
D

Dave Peterson

If you want to display that message when the cursor is hovering over the cell,
maybe you can use the comment for that cell.

You could use the worksheet_selectionchange event if you wanted to see the
message when that cell was selected.

Rightclick on the worksheet tab and select view code. Paste this into the code
window that just opened.

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Me.Range("B5").Value = ""

If Target.Cells.Count > 1 Then Exit Sub

If Intersect(Target, Me.Range("a1:A3")) Is Nothing Then
Exit Sub
End If

Me.Range("B5").Value = "Hello " & Target.Address(0, 0)

End Sub


Then back to excel and select one of those cells.
 
Top