A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

sub routine



 
 
Thread Tools Display Modes
  #1  
Old November 12th, 2009, 05:33 PM posted to microsoft.public.excel.misc
Jim
external usenet poster
 
Posts: 1,404
Default 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  
Old November 12th, 2009, 06:59 PM posted to microsoft.public.excel.misc
Tom Hutchins
external usenet poster
 
Posts: 722
Default 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  
Old November 13th, 2009, 12:15 AM posted to microsoft.public.excel.misc
Gord Dibben
external usenet poster
 
Posts: 20,252
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:14 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.