+ Reply to Thread
Results 1 to 4 of 4

Userform not passing through 1 particular public variable

  1. #1
    Registered User
    Join Date
    08-06-2014
    Location
    Australia
    MS-Off Ver
    2014
    Posts
    4

    Userform not passing through 1 particular public variable

    I have a userform that is called within a sub in module. I declared a public string, "divisonb", in the module. When the userform's ok button is clicked, I define the public string through a "select case" method.

    At the end of the private sub for the ok button click I have this:
    Please Login or Register  to view this content.
    a message box comes up with the correct string for divisonb. After the sub ends and it returns to the module I have the following:

    Please Login or Register  to view this content.
    When this message box pops up, it is blank. Somehow, divisonb was redifined as blank within that 2 lines of code. Anyone know why? All my other public strings are returned to the module with their correct values.

    Thanks...

  2. #2
    Forum Contributor
    Join Date
    10-30-2013
    Location
    Melbourne
    MS-Off Ver
    Excel 2013
    Posts
    173

    Re: Userform not passing through 1 particular public variable

    Is your string declared in a normal module or in the UserForm module?


    Sent from my iPad using Tapatalk

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Userform not passing through 1 particular public variable

    What is the code in the user form that is supposed to set the value of divisionb ?
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  4. #4
    Registered User
    Join Date
    08-06-2014
    Location
    Australia
    MS-Off Ver
    2014
    Posts
    4

    Re: Userform not passing through 1 particular public variable

    Hey guys, thanks for the quick responses.

    The public declaration is in the module, not the userform. Below is the code that defines divisionb


    Below is the code that definies divisonb. Divisonbox is the input box in the userform.

    Please Login or Register  to view this content.

+ 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/declarations not passing to UserForm from Application Caller Button
    By Lungfish in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-02-2013, 06:11 PM
  2. passing variable from userform
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-31-2010, 08:22 PM
  3. Losing public variable when submitting userform
    By JP Romano in forum Excel General
    Replies: 2
    Last Post: 01-29-2009, 11:39 AM
  4. Passing Variable from Sheet to Userform
    By gti_jobert in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-27-2006, 05:38 AM
  5. [SOLVED] Pass public variable from one userform to a second...
    By Mike Dunworth in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-03-2005, 08: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