PC Review


Reply
Thread Tools Rate Thread

automation of sub

 
 
Jim
Guest
Posts: n/a
 
      12th Nov 2009
I posted this question on the General Board, but I was unable to obtain a
workable answer, can anyone on this board help?

Thanks,

Jim

original post>>>
"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


Response Provided:

> 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



Result:

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

Jim


 
Reply With Quote
 
 
 
 
Mike H
Guest
Posts: n/a
 
      12th Nov 2009
Jim

There are 2 events you could use.

Private Sub Workbook_SheetActivate(ByVal Sh As Object)

or

Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)

Mike



"Jim" wrote:

> I posted this question on the General Board, but I was unable to obtain a
> workable answer, can anyone on this board help?
>
> Thanks,
>
> Jim
>
> original post>>>
> "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

>
> Response Provided:
>
> > 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

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

 
Reply With Quote
 
Tom Hutchins
Guest
Posts: n/a
 
      12th Nov 2009
Please don't multi-post the same question. I replied to your other post a few
minutes ago.

Hutch

"Jim" wrote:

> I posted this question on the General Board, but I was unable to obtain a
> workable answer, can anyone on this board help?
>
> Thanks,
>
> Jim
>
> original post>>>
> "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

>
> Response Provided:
>
> > 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

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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access automation leaves Excel open which in turn locks 2nd automation attempts EagleOne@discussions.microsoft.com Microsoft Access 8 30th Jun 2008 01:27 AM
Supressing the ctrl-c and other keys during word automation in automation apondu Microsoft Dot NET 0 19th Jul 2007 10:15 PM
Supressing the ctrl-c and other keys during word automation in automation apondu Microsoft C# .NET 0 19th Jul 2007 10:15 PM
Supressing the ctrl-c and other keys during word automation in automation apondu Microsoft Word Document Management 0 19th Jul 2007 10:15 PM
Supressing the ctrl-c and other keys during word automation in automation apondu Microsoft ASP .NET 0 19th Jul 2007 10:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:46 PM.