+ Reply to Thread
Results 1 to 10 of 10

Save Userform Textbox Value to Another Workbook

  1. #1
    Forum Contributor
    Join Date
    09-26-2010
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    182

    Thumbs up Save Userform Textbox Value to Another Workbook

    Hi

    I have a userform in one workbook that has a text box to enter a value into a worksheet on another workbook. I also have a command button so that when clicked it will save the entry to the worksheet in the other workbook and then return to the previous userform

    Can anyone help me with the code for this

    Thanks
    Last edited by Mooseman60; 11-01-2010 at 06:22 AM. Reason: Problem Solved

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

    Re: Save Userform Textbox Value to Another Workbook

    You could put
    Please Login or Register  to view this content.
    in the Command Button's Click event.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Forum Contributor
    Join Date
    09-26-2010
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    182

    Red face Re: Save Userform Textbox Value to Another Workbook

    Mike

    I take onboard regarding cross posting and will abide by the forum rules

    I have placed your code but i am getting an error message on this piece of code saying

    Oject variable or with block variable not set

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by romperstomper; 11-01-2010 at 05:35 AM. Reason: correct tags for posterity

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

    Re: Save Userform Textbox Value to Another Workbook

    The variable ws has to be set before that line.

  5. #5
    Forum Contributor
    Join Date
    09-26-2010
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    182

    Re: Save Userform Textbox Value to Another Workbook

    Mike

    I'm no wizard with this VBA I'm just a beginner trying to get my head around code so what is the variable that needs to go before that line

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

    Re: Save Userform Textbox Value to Another Workbook

    I guess that this is the sheet you want ws to refer to
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    09-26-2010
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    182

    Re: Save Userform Textbox Value to Another Workbook

    Mike

    Have entered that code but still get the error Subscript out of range

    Please Login or Register  to view this content.

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

    Re: Save Userform Textbox Value to Another Workbook

    Are the names spelt correctly? Is the error on the

    ...= txtSupplier.Text line or the
    Set ws = ... line

  9. #9
    Forum Contributor
    Join Date
    09-26-2010
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    182

    Re: Save Userform Textbox Value to Another Workbook

    Thanks for your help Mike

    The problem was in the Set ws = line I had txtSuppliers instead of txtSupplier

  10. #10
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,973

    Re: Save Userform Textbox Value to Another Workbook

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save
    Everyone who confuses correlation and causation ends up dead.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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