Excel msgbox when cell range is clicked

  • Thread starter Thread starter SoggyCashew
  • Start date Start date
S

SoggyCashew

I want to have a msgbox appear when any cell in the workbook is selected.
How is this done.
 
Hi,

Di you really mean any cell!! If you do then right click your worksheet,
view code and paste this in.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
MsgBox "You just clicked " & Target.Address
End Sub

Or for when you click in a certain range

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("A1:A10")) Is Nothing Then
MsgBox "You just clicked " & Target.Address
End If
End Sub

Mike
 
Seems rather annoying to me but add this code to Thisworkbook module.

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, _
ByVal Target As Range)
MsgBox "annoying message"
End Sub


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top