ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   run macro on cell entry (https://www.excelbanter.com/excel-programming/432305-run-macro-cell-entry.html)

sleemo

run macro on cell entry
 
i want a macro to run after a number (any number) has been entered into a
cell i.e a2


Sam Wilson

run macro on cell entry
 

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.

"sleemo" wrote:

i want a macro to run after a number (any number) has been entered into a
cell i.e a2


sleemo

run macro on cell entry
 
thanks
i just had to add end if and worked great

"sleemo" wrote:

i want a macro to run after a number (any number) has been entered into a
cell i.e a2



All times are GMT +1. The time now is 03:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com