run macro on cell entry

  • Thread starter Thread starter sleemo
  • Start date Start date
S

sleemo

i want a macro to run after a number (any number) has been entered into a
cell i.e a2
 
In the VBE window, right click the sheet and view code. Change "(General)"
to "Worksheet" in the top left drop down box, and choose "Change" in the top
right.

Yopu should see:

Private Sub Worksheet_Change(ByVal Target As Range)

End Sub

In the main window. Between these two lines put this:

If Target.Address = "$A$2" And WorksheetFunction.IsNumber(Target.Value) =
True Then Call YourMacro()


Changing "YourMacro()" to the relevant macro.
 

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