macro start


Posted by david on July 19, 2000 9:33 PM

How about getting macro to start when a particular cell is activated. So when the cursor is set on cell j2 I want the macro to run. or maybe a message bax to pop up and ask me if i wasnt to run the macro or not if i2 is changed, so all i have to do is hit enter.



Posted by Ivan Moala on July 20, 0100 1:35 AM


In a worksheet code put this code in.

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Dim Ans As Integer
If Target.Address = "$J$2" Then
Ans = MsgBox("Run Macro ?", vbYesNo)
If Ans = vbYes Then MyMacro
End If
End Sub

Note: MyMacro = your macro name to run which
should reside in a Module.
To change the cell that activate the msgbox
then change $J$2 to you cell address.

HTH
Ivan