Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / September 2007

Tip: Looking for answers? Try searching our database.

activate macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Patrick - 05 Sep 2007 23:26 GMT
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
Earl Kiosterud - 05 Sep 2007 23:46 GMT
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

Signature

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...
-----------------------------------------------------------------------

> 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
Patrick - 06 Sep 2007 00:30 GMT
thanks

pat

> Patrick,
>
[quoted text clipped - 10 lines]
> >
> > pat
Gord Dibben - 05 Sep 2007 23:57 GMT
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

>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
Patrick - 06 Sep 2007 00:26 GMT
cheers
works a treat.

programmming in access is so much easier than excell.

but unfortunately am having to use it

pat

> Private Sub Worksheet_Activate()
>      macroname
[quoted text clipped - 10 lines]
> >
> >pat
Don Guillett - 05 Sep 2007 23:59 GMT
right click sheet tab>view code>left window select worksheet>right window
select sheet activate.

Signature

Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@austin.rr.com

> 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

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.