![]() |
Calling a VBA sub routine
Question for all you guru's. Is it possible to put a VBA sub routine in a
module, and then write a sub on sheet(1) that calls the module sub? I have a sub routine in a module which works when run manually, but I really want it to work when ever a cell on sheet 1 is changed. I already have a sub routine on sheet 1 now. -- Howard |
Calling a VBA sub routine
I assume you are saying that you already have a worksheet_change event. You should always post your code for comments. You can also have this. Perhaps a restriction if target.address="$A$2" then call subnamehere -- Don Guillett Microsoft MVP Excel SalesAid Software "Howard" wrote in message ... Question for all you guru's. Is it possible to put a VBA sub routine in a module, and then write a sub on sheet(1) that calls the module sub? I have a sub routine in a module which works when run manually, but I really want it to work when ever a cell on sheet 1 is changed. I already have a sub routine on sheet 1 now. -- Howard |
Calling a VBA sub routine
Hi,
yes you can do that worksheet code Private Sub Worksheet_Change(ByVal Target As Range) mysub End Sub and in a general module Sub mysub() MsgBox "Hello world" End Sub Mike "Howard" wrote: Question for all you guru's. Is it possible to put a VBA sub routine in a module, and then write a sub on sheet(1) that calls the module sub? I have a sub routine in a module which works when run manually, but I really want it to work when ever a cell on sheet 1 is changed. I already have a sub routine on sheet 1 now. -- Howard |
Calling a VBA sub routine
Thanks to both. I'm kind of new to VBA, but these ideas will help a lot.
I'll give them a try. -- Howard "Mike H" wrote: Hi, yes you can do that worksheet code Private Sub Worksheet_Change(ByVal Target As Range) mysub End Sub and in a general module Sub mysub() MsgBox "Hello world" End Sub Mike "Howard" wrote: Question for all you guru's. Is it possible to put a VBA sub routine in a module, and then write a sub on sheet(1) that calls the module sub? I have a sub routine in a module which works when run manually, but I really want it to work when ever a cell on sheet 1 is changed. I already have a sub routine on sheet 1 now. -- Howard |
Calling a VBA sub routine
|
All times are GMT +1. The time now is 12:36 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com