Consulting

Results 1 to 7 of 7

Thread: Variables not stored globally?

  1. #1

    Variables not stored globally?

    hey guys, me again, im almost done writing this application but the problem is is that the value of my variable nummarks is not being used globally. it simply gets set back to 0. attached is my program. help would be muy bien

  2. #2
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    It is declared in a userform's code module. It will go to zero when the userform is unloaded.

  3. #3
    is there a way i can still do it? because i need to unload the form so that i can write stuff in the cells.

  4. #4
    Moderator VBAX Master geekgirlau's Avatar
    Joined
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,464
    Location
    You don't need to unload the user form first - populate your cells, then unload the form.

  5. #5
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    All of your code is in the userforms code module, if the UF is unloaded, your code doesn't run.

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    I don't get it. You create the table. You can add values okay. Whyt do you need to get the variable afterwards?

    and the average calculation is a bit awry.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  7. #7
    Quote Originally Posted by xld
    I'm quicker than Tristan and he's older.l
    Yeah ! but you're slower than Speedy ... and he's only a mouse ...
    2+2=9 ... (My Arithmetic Is Mental)

Posting Permissions

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