PC Review


Reply
Thread Tools Rate Thread

activate macro

 
 
=?Utf-8?B?UGF0cmljaw==?=
Guest
Posts: n/a
 
      5th Sep 2007
how do i automatically run a macro when i move from one worksheet to another.

ie select another worksheet, then automatically run a specific macro


pat
 
Reply With Quote
 
 
 
 
Earl Kiosterud
Guest
Posts: n/a
 
      5th Sep 2007
Patrick,

Put this sub in the ThisWorkbook module. Sh will be the worksheet that was just activated.

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
MsgBox Sh.Name
' take out the line above and put in your code
End Sub

--
Earl Kiosterud
www.smokeylake.com

Note: Top-posting has been the norm here.
Some folks prefer bottom-posting.
But if you bottom-post to a reply that's
already top-posted, the thread gets messy.
When in Rome...
-----------------------------------------------------------------------
"Patrick" <(E-Mail Removed)> wrote in message
newsF680402-A500-4001-8954-(E-Mail Removed)...
> how do i automatically run a macro when i move from one worksheet to another.
>
> ie select another worksheet, then automatically run a specific macro
>
>
> pat



 
Reply With Quote
 
Gord Dibben
Guest
Posts: n/a
 
      5th Sep 2007
Private Sub Worksheet_Activate()
macroname
End Sub

This is sheet event code and goes into the sheet module of whichever sheet is be
activated for the macro to run.


Gord Dibben MS Excel MVP

On Wed, 5 Sep 2007 15:26:02 -0700, Patrick <(E-Mail Removed)>
wrote:

>how do i automatically run a macro when i move from one worksheet to another.
>
>ie select another worksheet, then automatically run a specific macro
>
>
>pat


 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      5th Sep 2007
right click sheet tab>view code>left window select worksheet>right window
select sheet activate.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"Patrick" <(E-Mail Removed)> wrote in message
newsF680402-A500-4001-8954-(E-Mail Removed)...
> how do i automatically run a macro when i move from one worksheet to
> another.
>
> ie select another worksheet, then automatically run a specific macro
>
>
> pat


 
Reply With Quote
 
=?Utf-8?B?UGF0cmljaw==?=
Guest
Posts: n/a
 
      6th Sep 2007
cheers
works a treat.

programmming in access is so much easier than excell.



but unfortunately am having to use it


pat

"Gord Dibben" wrote:

> Private Sub Worksheet_Activate()
> macroname
> End Sub
>
> This is sheet event code and goes into the sheet module of whichever sheet is be
> activated for the macro to run.
>
>
> Gord Dibben MS Excel MVP
>
> On Wed, 5 Sep 2007 15:26:02 -0700, Patrick <(E-Mail Removed)>
> wrote:
>
> >how do i automatically run a macro when i move from one worksheet to another.
> >
> >ie select another worksheet, then automatically run a specific macro
> >
> >
> >pat

>
>

 
Reply With Quote
 
=?Utf-8?B?UGF0cmljaw==?=
Guest
Posts: n/a
 
      6th Sep 2007
thanks


pat


"Earl Kiosterud" wrote:

> Patrick,
>
> Put this sub in the ThisWorkbook module. Sh will be the worksheet that was just activated.
>
> Private Sub Workbook_SheetActivate(ByVal Sh As Object)
> MsgBox Sh.Name
> ' take out the line above and put in your code
> End Sub
>
> --
> Earl Kiosterud
> www.smokeylake.com
>
> Note: Top-posting has been the norm here.
> Some folks prefer bottom-posting.
> But if you bottom-post to a reply that's
> already top-posted, the thread gets messy.
> When in Rome...
> -----------------------------------------------------------------------
> "Patrick" <(E-Mail Removed)> wrote in message
> newsF680402-A500-4001-8954-(E-Mail Removed)...
> > how do i automatically run a macro when i move from one worksheet to another.
> >
> > ie select another worksheet, then automatically run a specific macro
> >
> >
> > pat

>
>
>

 
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
activate macro Jase Microsoft Excel Misc 1 9th Jun 2008 08:25 PM
How to activate a macro Gary Microsoft Outlook VBA Programming 1 4th Apr 2008 12:05 AM
Activate a Macro when.. Rossella Microsoft Excel Discussion 5 17th Jul 2006 11:30 AM
Activate Macro GTessier Microsoft Outlook VBA Programming 2 27th Aug 2004 07:37 PM
Button to Activate Macro =?Utf-8?B?Sm9u?= Microsoft Excel Misc 3 24th Feb 2004 12:15 AM


Features
 

Advertising
 

Newsgroups
 


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