+ Reply to Thread
Results 1 to 2 of 2

Using Variables from Modules in Userforms

  1. #1
    Registered User
    Join Date
    08-27-2008
    Location
    United States
    Posts
    45

    Using Variables from Modules in Userforms

    Hello,

    I was wondering if there is a good way to effectively be able to use variables in userforms, or allow them to manipulate them, without declaring them public.

    I have a sub, which opens a userform, and want to be able to use variables used within the sub. To the best of my knowledge I cannot pass a variable to a userform the way you can from one sub to another.

    The way I have been doing this has been simply to declare variables as public variables, but those seem to be not preferred by other programmers and I am looking for a better alternative.

    Thanks,
    googlebot

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437
    You can declare variables within the userform class and reference them that way.

    Code in standard code module

    Please Login or Register  to view this content.
    Userform, with a single commandbutton

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

+ 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. carrying over variables from userforms
    By T1M4 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-04-2008, 11:21 AM
  2. Exporting UserForms and or Modules
    By Rick_Stanich in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-12-2008, 12:37 PM
  3. User-defined variables in MS access query
    By ratzy in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-11-2007, 11:13 AM
  4. Passing Variables between Modules
    By wombat7 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-04-2007, 01:49 PM
  5. proper format for functions
    By DKY in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-13-2007, 08:39 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