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 / Programming / May 2008

Tip: Looking for answers? Try searching our database.

Calling a Sub from Another Sheet

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
baconcow - 29 May 2008 16:31 GMT
I have multiple sheets all running code. However, there are times when I
would rather call a sub from another worksheet instead of duplicating the
code.

I used Call SubName to call it from the active sheet. What is the syntax for
calling it from say, Sheet1(Surface) instead of the current Sheet13(Intro)

Also, is there any way to organize the "Sheet1", "Sheet2", etc? Under
Microsoft Excel Objects, the actual order of the sheets is so out of order.
The "SheetX" name seems to be given when the sheets are created. Can this be
changed to better sort them?

Thanks
Norman Jones - 29 May 2008 16:47 GMT
Hi Baconcow,

Try moving these subs to a standard module:

In the VBE,

   Menu | Insert | Module.

A worksheet modul should normally only be
used for worksheet event code.

---
Regards.
Norman
>I have multiple sheets all running code. However, there are times when I
> would rather call a sub from another worksheet instead of duplicating the
[quoted text clipped - 12 lines]
>
> Thanks
baconcow - 29 May 2008 16:55 GMT
How do I call a sub that is on the standard module from the active worksheet?

> Hi Baconcow,
>
[quoted text clipped - 26 lines]
> >
> > Thanks
Norman Jones - 29 May 2008 17:03 GMT
Hi Baconcow,

============
How do I call a sub that is on the standard module from the active
worksheet?
============

If you refer to calling a sub in a standard module
from worksheet event code, try:

      Call myMacro

In fact, the same would apply to non event code
but, as indicated previously, a worksheet module
should normally only house worksheet event code

---
Regards.
Norman

> How do I call a sub that is on the standard module from the active
> worksheet?
[quoted text clipped - 13 lines]
>> Regards.
>> Norman
 
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.