+ Reply to Thread
Results 1 to 6 of 6

Public variables

  1. #1
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Waterbury, CT
    MS-Off Ver
    Office 365
    Posts
    1,175

    Public variables

    Hello,
    When i work with userforms I find Public variables very helpful because I can call them anywhere in my project.
    Is it possible though to assign a public macro where various parts of the userform can always refer to it without having to write the code over again?
    For example:
    Please Login or Register  to view this content.
    Thanks in advance!

  2. #2
    Valued Forum Contributor
    Join Date
    10-05-2014
    Location
    Regina, SK Canada
    MS-Off Ver
    Excel for Mac 11
    Posts
    330

    Re: Public variables

    I think you can do it this way, in the code sheet module for the workbook, so that it runs and initializes your public variables when the workbook is opened.
    Please Login or Register  to view this content.
    Last edited by StuCram; 12-15-2015 at 06:15 PM.
    If this has been helpful, please click on the star at the left.

  3. #3
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Waterbury, CT
    MS-Off Ver
    Office 365
    Posts
    1,175

    Re: Public variables

    Hi Stucram,
    Thank you for your reply.
    I am leaving work now so i won't be able to test your response till tomorrow.
    I will let you know how it worked out.
    Once again thanks.

  4. #4
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Waterbury, CT
    MS-Off Ver
    Office 365
    Posts
    1,175

    Re: Public variables

    Hi Stucram,
    Where would i insert this portion:
    Please Login or Register  to view this content.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Public variables

    It MUST go in ThisWorkbook.
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Waterbury, CT
    MS-Off Ver
    Office 365
    Posts
    1,175

    Re: Public variables

    Thank you all

+ 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. [SOLVED] Public Variables
    By iamGreenhorn in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-21-2014, 12:38 PM
  2. Public Variables
    By carsto in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-24-2008, 03:56 PM
  3. Public variables
    By Tomski in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-10-2006, 10:20 AM
  4. Public Variables
    By daniroy@gmail.com in forum Excel General
    Replies: 6
    Last Post: 09-12-2005, 12:05 PM
  5. Public Variables
    By johnhildreth@charter.net in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-01-2005, 12:05 PM
  6. [SOLVED] Public Variables
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-21-2005, 07:06 AM
  7. Public variables
    By jcp29 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-02-2005, 07:10 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