If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
sub routine
First of all, please excuse the re-post, but I didn't receive a workable
answer to my original post. Please see below, Thanks.... We have a workbook with multiple worksheets. I have written a procedure which checks for data outside of a specified range on the worksheet. Is it possible to have this procedure run automatically whenever a user activates a new worksheet in the workbook? I realize that the procedure can be tied to a key combination, or command button, but that requires input from the user. For this application, we need to automate the process. Thanks, Jim |
#2
|
|||
|
|||
sub routine
Call your procedure from a Workbook_SheetActivate event. The
Workbook_SheetActivate must be in the ThisWorkbook module. In the Visual Basic Editor, double-click on the ThisWorkbook module in the Project Explorer (if you don't see the Project Explorer, select View Project Explorer). There are two wide dropdown boxes across the top. In the left dropdown, select Workbook. Then, in the right dropdown, select SheetActivate. This creates a Workbook_SheetActivate event (with no code to do anything). Add a Call statement to run your procedure. Make sure your procedure operates on the ActiveSheet. Also, if your procedure is Private or is in the code module for a particular worksheet, move it to ThisWorkbook or a general VBA module and make it Public. If you are relatively new to macros, this link to Jon Peltier's site may be helpful: http://peltiertech.com/WordPress/200...e-elses-macro/ Hope this helps, Hutch "Jim" wrote: First of all, please excuse the re-post, but I didn't receive a workable answer to my original post. Please see below, Thanks.... We have a workbook with multiple worksheets. I have written a procedure which checks for data outside of a specified range on the worksheet. Is it possible to have this procedure run automatically whenever a user activates a new worksheet in the workbook? I realize that the procedure can be tied to a key combination, or command button, but that requires input from the user. For this application, we need to automate the process. Thanks, Jim |
#3
|
|||
|
|||
sub routine
You were given a workable answer to your first post.
Jacob provided it. You just did not follow his steps. Gord Dibben MS Excel MVP On Thu, 12 Nov 2009 09:33:01 -0800, Jim wrote: First of all, please excuse the re-post, but I didn't receive a workable answer to my original post. Please see below, Thanks.... We have a workbook with multiple worksheets. I have written a procedure which checks for data outside of a specified range on the worksheet. Is it possible to have this procedure run automatically whenever a user activates a new worksheet in the workbook? I realize that the procedure can be tied to a key combination, or command button, but that requires input from the user. For this application, we need to automate the process. Thanks, Jim |
Thread Tools | |
Display Modes | |
|
|