Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Global/Static Variables

  1. #1
    New Member
    Join Date
    Mar 2002
    Posts
    34
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    How do I decare a Global variable that will be available to the entire workbook as a static. I need to procuce a lot of the same sheet with 2 name changes on each one, but the names are used throughout the code. It's easier to change 2 variables than go through the code and do it that way.

  2. #2
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi

    At the very top of standard module use:


    Public Const MyNum As Integer = 256

  3. #3
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Bogota, Colombia
    Posts
    11,959
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Dave "teaches" how to add a public constant, but if you need a variable, use this:

    Public MyNum As Integer

    That will be available to all modules
    Regards,

    Juan Pablo González
    http://www.juanpg.com

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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