+ Reply to Thread
Results 1 to 3 of 3

Return value of userform.

  1. #1
    Registered User
    Join Date
    07-14-2020
    Location
    Kerala, India
    MS-Off Ver
    MS Office Professional Plus 2013
    Posts
    29

    Return value of userform.

    Dear friends,

    I have a simple userform with a combobox populated with name of months. I opens it each time I double-click in a cell. If the cell contains a month name, the combobox sets that as its value or as the current month if the cell does not match to a month name. Works fine.

    I am passing the cell value to the userform with its Tag property since there is no other way we can easily pass input variables to a form. I am not comfortable in using global variables.

    Once the user selects a month in the combobox and accepts it by pressing the Accept button, I want the userform to return the selected value for the month. If the userform is closed otherwise by its closing button, I want the userform to return the value passed into it. I have checked the coding for this functionality by printing out Tag property of userform when the form is about to close (using QueryClose event of the form). But I am stuck up how it has to be passed back the calling program when the userform is deactivated.

    My sample file is attached.

    Regards,
    Pravin Kumar.
    Attached Files Attached Files

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    19,834

    Re: Return value of userform.

    You can load the form and reference controls or properties.

    Here is the code for the userform
    Please Login or Register  to view this content.
    And this is the code used to load, set and read the userform
    Thisworkbook code module
    Please Login or Register  to view this content.
    There is no code to handle a cell which contains a non month value
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    07-14-2020
    Location
    Kerala, India
    MS-Off Ver
    MS Office Professional Plus 2013
    Posts
    29

    Re: Return value of userform.

    Excellent, Andy Pope.
    Regards.

+ 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. Return array from UserForm
    By pp57 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-27-2017, 01:09 AM
  2. [SOLVED] Msgbox from Userform - how to return to Userform and retain the inputs
    By nickersonpower in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-05-2017, 12:14 PM
  3. Exit Userform to return to main code, but keep userform open
    By jombler74 in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 09-04-2014, 04:01 AM
  4. Return to userform after msgbox?
    By dbjofo in forum Excel General
    Replies: 11
    Last Post: 02-06-2014, 12:58 PM
  5. Return to userform after msgbox??
    By dbjofo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-06-2014, 11:47 AM
  6. Double click row to return data to userform for edit then return back to sheet
    By MattRSJ in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 01-31-2014, 06:05 AM
  7. userform return value
    By gtmeloney in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-08-2009, 11:26 AM

Tags for this Thread

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