Can I launch macro by a cell click ?

  • Thread starter Thread starter Cedric Dennis
  • Start date Start date
C

Cedric Dennis

Hi
Can I launch a macro simply by clicking a cell ?
What command would I need to type in the cell ?
Please help if you can.
Thankyou
Cedric
 
You can use this event in the sheet module for Cell A1
It will also run if you select the cell with the arrow keys

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Application.Intersect(Range("A1"), Target) Is Nothing Then
yourmacro
End If
End Sub

Sub yourmacro()
MsgBox "Hi"
End Sub
 
right click sheet tab>view code>insert this>save to suit>SAVE

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$C$1" Then doit
End Sub
Sub doit()
MsgBox "Hi"
End Sub
 
Back
Top