+ Reply to Thread
Results 1 to 5 of 5

Public Worksheet Declaration

  1. #1
    Forum Contributor
    Join Date
    09-02-2005
    Posts
    146

    Public Worksheet Declaration

    I'm using a public declaration for a worksheet but I seem to have to initialize it in each routine. Is there a way to set it and leave it?

    So in a module I have:
    Please Login or Register  to view this content.
    Last edited by wilro85; 08-28-2009 at 07:48 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Public Worksheet Declaration

    It will stay set indefinitely (i.e., until you push the reset button, execute an End statement, or explicitly clear it) after it is initially set.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983

    Re: Public Worksheet Declaration

    If you have several macros that you run individually you need to set it within each macro.

    If you call a macro from another macro then you only need to set it within the 1st run macro
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  4. #4
    Forum Contributor
    Join Date
    09-02-2005
    Posts
    146

    Re: Public Worksheet Declaration

    Could you clarify what you mean by "end" statement? Obviously it isn't an "end if" but how about "end sub" or "end function"?

    What is the "standard" way of doing this? Do many people do their declarations in the workbook_open event?

    *Edit*
    Ok, mudraker's answer is what I was looking for.
    Last edited by wilro85; 08-28-2009 at 07:47 PM. Reason: Someone answered while I ask typing this.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Public Worksheet Declaration

    clarify what you mean by "end" statement
    Please Login or Register  to view this content.
    See VBE Help for End Statement

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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