PDA

View Full Version : [SOLVED] Run Marco by click on a cell



blackice
07-05-2005, 01:51 PM
Can I run a macro by clicking on a cell. if not how about if i type in the cell.
thanks

Jacob Hilderbrand
07-05-2005, 01:54 PM
Actually you can do both.


Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
MsgBox "Hi"
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("A1")) Is Nothing Then
MsgBox "Hi"
End If
End Sub


Just put this code the the sheet code module for the sheet you want this to trigger on.