Enabling Macro with the worksheet file
first of all Thanks to Fst1
I have recently created a macro, it works fine once when I execute selecting Tools-Macro -Run. I want the macro to be executed every moment I enter data, Instead of I running this macro each & every time I enter the data.(i.e., results to be displayed on the worksheet.) Also How can I automate this process of opening this particular worksheet, prompt user to enter data, run the macro and display the result. Opening worksheet is once, calculating for different user inputs until user says enough. Pl let me know Regards -- reply to my posts are welcome |
Enabling Macro with the worksheet file
Let's say your macro is called macro1.
Install the following worksheet event macro to work with your original macro: Private Sub Worksheet_Change(ByVal Target As Range) Application.EnableEvents = False Call macro1 Application.EnableEvents = True End Sub Because it is worksheet code, it is very easy to install and automatic to use: 1. right-click the tab name near the bottom of the Excel window 2. select View Code - this brings up a VBE window 3. paste the stuff in and close the VBE window If you have any concerns, first try it on a trial worksheet. If you save the workbook, the macro will be saved with it. To remove the macro: 1. bring up the VBE windows as above 2. clear the code out 3. close the VBE window To learn more about macros in general, see: http://www.mvps.org/dmcritchie/excel/getstarted.htm To learn more about Event Macros (worksheet code), see: http://www.mvps.org/dmcritchie/excel/event.htm -- Gary''s Student - gsnu200751 "NSNR" wrote: first of all Thanks to Fst1 I have recently created a macro, it works fine once when I execute selecting Tools-Macro -Run. I want the macro to be executed every moment I enter data, Instead of I running this macro each & every time I enter the data.(i.e., results to be displayed on the worksheet.) Also How can I automate this process of opening this particular worksheet, prompt user to enter data, run the macro and display the result. Opening worksheet is once, calculating for different user inputs until user says enough. Pl let me know Regards -- reply to my posts are welcome |
Enabling Macro with the worksheet file
Hi
Thanks for your reply It worked. Regards -- reply to my posts are welcome "Gary''s Student" wrote: Let's say your macro is called macro1. Install the following worksheet event macro to work with your original macro: Private Sub Worksheet_Change(ByVal Target As Range) Application.EnableEvents = False Call macro1 Application.EnableEvents = True End Sub Because it is worksheet code, it is very easy to install and automatic to use: 1. right-click the tab name near the bottom of the Excel window 2. select View Code - this brings up a VBE window 3. paste the stuff in and close the VBE window If you have any concerns, first try it on a trial worksheet. If you save the workbook, the macro will be saved with it. To remove the macro: 1. bring up the VBE windows as above 2. clear the code out 3. close the VBE window To learn more about macros in general, see: http://www.mvps.org/dmcritchie/excel/getstarted.htm To learn more about Event Macros (worksheet code), see: http://www.mvps.org/dmcritchie/excel/event.htm -- Gary''s Student - gsnu200751 "NSNR" wrote: first of all Thanks to Fst1 I have recently created a macro, it works fine once when I execute selecting Tools-Macro -Run. I want the macro to be executed every moment I enter data, Instead of I running this macro each & every time I enter the data.(i.e., results to be displayed on the worksheet.) Also How can I automate this process of opening this particular worksheet, prompt user to enter data, run the macro and display the result. Opening worksheet is once, calculating for different user inputs until user says enough. Pl let me know Regards -- reply to my posts are welcome |
All times are GMT +1. The time now is 02:52 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com