Results 1 to 4 of 4

Global variable not retaining value

Threaded View

  1. #1
    Forum Contributor
    Join Date
    09-05-2011
    Location
    Essex, England
    MS-Off Ver
    Excel 2003 Excel 2007
    Posts
    383

    Global variable not retaining value

    Good Morning All,

    I'm having a problem with a global value retaining its value between the workbook_open event and module code.

    I have the following declared above everything else in my Thisworkbook module
    Option Explicit
     Public N As Integer
     Public WS As Worksheet
     Public RUNNOW As Double
     Public PUB_PWORD As Integer
    At the end of my workbookopen event I have
     PUB_PWORD = 0
        End Sub
    when debugging (f8) PUB_PWORD has a value of 0 as expected until it hits the ends sub where it becomes 'empty'

    I have a module that is checking the value of PUB_PWORD and i its not 1 running code before setting it to the value of 1

    I know I could store the value within a worksheet cell but as I only needed to retain value for the user session didn't think it would be required.

    any ideas why this might be failing?
    Last edited by Kramxel; 07-07-2015 at 06:51 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Global Variable is not retaining its value
    By mahmud1280 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-19-2015, 07:32 AM
  2. [SOLVED] Global variable declared in Userform. Variable value is not sticking
    By timtim89 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-25-2012, 08:50 AM
  3. Replies: 3
    Last Post: 09-06-2005, 04:05 AM
  4. Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  5. Replies: 1
    Last Post: 07-08-2005, 09:05 PM

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