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 procedure



 
 
Thread Tools Display Modes
  #1  
Old November 12th, 2009, 02:26 PM posted to microsoft.public.excel.misc
Jim
external usenet poster
 
Posts: 1,404
Default sub procedure

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, 02:34 PM posted to microsoft.public.excel.misc
Jacob Skaria
external usenet poster
 
Posts: 5,952
Default sub procedure

From workbook press Alt+F11 to launch VBE (Visual Basic Editor). From the
left treeview search for the workbook name and click on + to expand it.
Within that you should see the following

VBAProject(Your_Filename)
Microsoft Excel Objects
Sheet1(Sheet1)
Sheet2(Sheet2)
Sheet3(Sheet3)
This Workbook

Double click 'This WorkBook' and check out the drop downs for the below event

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
'call your procedure here
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Jim" wrote:

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 12th, 2009, 02:52 PM posted to microsoft.public.excel.misc
Jim
external usenet poster
 
Posts: 1,404
Default sub procedure

Thank you for your reply, however this event is not shown in the drop down
box. The events begin with AcceptLabelsInFormulas. Is it possible that I
may be looking in the incorrect drop down box?

Jim

"Jacob Skaria" wrote:

From workbook press Alt+F11 to launch VBE (Visual Basic Editor). From the
left treeview search for the workbook name and click on + to expand it.
Within that you should see the following

VBAProject(Your_Filename)
Microsoft Excel Objects
Sheet1(Sheet1)
Sheet2(Sheet2)
Sheet3(Sheet3)
This Workbook

Double click 'This WorkBook' and check out the drop downs for the below event

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
'call your procedure here
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Jim" wrote:

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 08:15 AM.


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