+ Reply to Thread
Results 1 to 4 of 4

VBA Global Constant

  1. #1
    Registered User
    Join Date
    09-25-2008
    Location
    ny
    Posts
    9

    VBA Global Constant

    Hi All,

    I am trying to use the following code to define a global constant .

    Public Const WorkSht = "Detailed Schedule"

    However, I get a run time error, and found that WorkSht is empty. Would be nice to solve this.

    Many thanks.

    Buyi

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,479

    Re: VBA Global Constant

    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    09-25-2008
    Location
    ny
    Posts
    9

    Re: VBA Global Constant

    Thanks for the reply.

    Actually it was a dumb error on my part. I first used WorkSht as a variable. Then thought it is better to use a constant. However, forgot to remove the dim in my sub. so the variable got redefined as a string variable in the scope of the sub.

    Thanks anyway.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,479

    Re: VBA Global Constant

    Easily done.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 11-11-2015, 04:26 AM
  2. [SOLVED] Global Constant Password ThisWorkbook Module
    By Delvesy888 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-21-2014, 06:14 AM
  3. Declaring Global Constant
    By anteagles20 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-11-2012, 04:59 AM
  4. Sum of constant + variable = constant
    By neurogirl900 in forum Excel General
    Replies: 3
    Last Post: 12-19-2011, 11:02 PM
  5. Global Range
    By samshut in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-23-2007, 04:00 PM
  6. [SOLVED] Global/Public
    By Fox via OfficeKB.com in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-26-2006, 03:50 PM
  7. Global.xls
    By hojo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-23-2006, 10:52 AM

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