+ Reply to Thread
Results 1 to 4 of 4

Recall another Sub

  1. #1
    Registered User
    Join Date
    08-24-2010
    Location
    Nijmegen, Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    10

    Recall another Sub

    Hello,

    for preventing unnecessary repetition in a Sub I would like to make a method (or Sub I don't know how to call it but you know what I mean) outside of the sub that can be recalled from the first Sub. So for that I have two questions:
    1. What code could I use for activating another Sub within the first Sub?
    2. Is it better to make the 'other' Sub public?

    I'm hoping someone could help me again with this one. Because of this forum now I'm almost ready writing an application for Tray Selection..

    Regards

    Jeroen

  2. #2
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Recall another Sub

    Would this be of help?

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    03-11-2010
    Location
    India
    MS-Off Ver
    2010
    Posts
    268

    Re: Recall another Sub

    1. What code could I use for activating another Sub within the first Sub?
    Please Login or Register  to view this content.
    2. Is it better to make the 'other' Sub public?
    If the other sub is in same module, you do not need to make it public. Else, you will have to.

    hth
    Ajay

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Recall another Sub

    As regards scope (qu. 2):
    If you make the sub Public (the default), it is visible to all other subs in your workbook and to the macros dialog (unless the sub takes arguments); if you make it private, it is visible only to routines in the same module, and not to the macros dialog. If you add:
    Please Login or Register  to view this content.
    to your module then the macros are not visible to the macros dialog, but the two rules above apply as regards visibility to other code in your workbook.
    Note: regardless of scope, all macros can be accessed from the macros dialog if you know the name of them (even if you can't successfully run them).
    The same basic rules apply to functions, but substitute the function wizard for the macros dialog.
    Remember what the dormouse said
    Feed your head

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1