+ Reply to Thread
Results 1 to 5 of 5

Tranferring Variable Entry from Form Entry to Macro

  1. #1
    Registered User
    Join Date
    04-22-2009
    Location
    Austin, Texas, USA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Tranferring Variable Entry from Form Entry to Macro

    I used a form with textboxes for data input for one of my vb macros. Currently I have the private sub from the form transfer those entries to a remote cell on the spreadsheet, (like in column "HZ"), so that the macro that will actually utilize them can retrieve them. Is there a way to pass that data directly from what is entered in the form in the textboxes to the macro that will actually use them? Thanks
    Last edited by austindude; 05-03-2009 at 01:53 AM.

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

    Re: Tranferring Variable Entry from Form Entry to Macro

    A macro can read the value of a textbox directly:
    someString = userform1.textbox1.value
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    04-18-2009
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2016
    Posts
    269

    Thumbs up Re: Tranferring Variable Entry from Form Entry to Macro

    Hi Austin,

    You can use the code given by Shg till the time the Userform has not been unloaded. Once you unload the userform, the value is lost. However, you can store them in a global variable which you have to initialize in a module as:
    Please Login or Register  to view this content.
    and then before unloading the userform, write the code:
    Please Login or Register  to view this content.
    followed by your macro which can use the value of xyz.

    Regards,
    Karan

  4. #4
    Registered User
    Join Date
    04-22-2009
    Location
    Austin, Texas, USA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Tranferring Variable Entry from Form Entry to Macro

    Thanks for Replying. It was extremely helpful.

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

    Re: Tranferring Variable Entry from Form Entry to Macro

    You’re welcome. Would you please mark the thread as Solved?

    Click the Edit button on your first post in the thread

    Click Go Advanced, select [SOLVED] from the Prefix dropdown, then click Save Changes

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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