+ Reply to Thread
Results 1 to 4 of 4

Pass a value collected through user form into a module

  1. #1
    Forum Contributor
    Join Date
    03-02-2014
    Location
    usa
    MS-Off Ver
    MS 365
    Posts
    593

    Pass a value collected through user form into a module

    Hello,

    I have a userform which collects from a TextBox "Names" on CommandButton1_Click()

    The userform is initiated through a macro in Module1

    What I am after, is to pass the Names.Value into Module1.
    I tried to declare the Name as public, and Global, but it won't do the trick.
    Could you please advise?
    Thanks

  2. #2
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,176

    Re: Pass a value collected through user form into a module

    userform IS a module.
    but if you want module1 to see form data, then make the variables PUBLIC in module1

    -----in module1:
    public gvName

    then assign gvName to a form object
    gvName = txtBox1

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,607

    Re: Pass a value collected through user form into a module

    code in form:
    Please Login or Register  to view this content.
    code in standard module
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by protonLeah; 12-20-2021 at 03:37 PM.
    Ben Van Johnson

  4. #4
    Forum Contributor
    Join Date
    03-02-2014
    Location
    usa
    MS-Off Ver
    MS 365
    Posts
    593

    Re: Pass a value collected through user form into a module

    Thank you!

+ 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] Existence checks collected in one module
    By Warbe in forum Tips and Tutorials
    Replies: 6
    Last Post: 12-28-2019, 03:03 PM
  2. [SOLVED] Pass an array collected from textboxes to a multicolumn listbox as an next entry
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-19-2018, 09:09 AM
  3. USER form..need to use to pass a variable to a cell reference and back.
    By pecan111 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-08-2016, 02:49 PM
  4. Using Variables between Module and User Form
    By rbirch in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-02-2015, 02:16 PM
  5. [SOLVED] pass variable for user form module to function
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-10-2012, 10:10 PM
  6. Pass Value/text from User Form to Macro
    By tompa in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-24-2011, 07:00 PM
  7. Pass variable from user form to macro
    By r wilcox in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-23-2005, 03:06 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