+ Reply to Thread
Results 1 to 2 of 2

Public variable losing value

  1. #1
    Registered User
    Join Date
    08-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    1

    Public variable losing value

    I'm declaring a Public variable (Public dt as date) as first line on the first Module but when I change to a different worksheet in same workbook it reverts to 1899. Watch says it's out of context and empty. I've tried declaring it as a variant (I've had other problems with dates, curse you Americans with your illogical date format) and as Global but makes no difference. Any ideas, please?

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644
    Where exactly are you declaring it?

    It should be in a standard module (Insert>Module) not a worksheet, workbook or userform module.
    If posting code please use code tags, see here.

+ 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