+ Reply to Thread
Results 1 to 20 of 20

Add data from userform to specific cells on worksheet

  1. #1
    Registered User
    Join Date
    03-07-2017
    Location
    Stockport, England
    MS-Off Ver
    2007
    Posts
    91

    Add data from userform to specific cells on worksheet

    Hello again Excel Forum,

    I am struggling to add data I have collected in a user form to exact cells in a spreadsheet. It is address information to display on an invoice. All the code I have been able to see thus far refers to looping the info into each subsequent row. I have 5 Text boxes with 4 of them to enter their collected data into ("E8:E13"). So far nothing works. Anybody got anything simple. NB It would be the same data field each time so I wouldn't need to x1up or down.
    Thanks in advance.

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Add data from userform to specific cells on worksheet

    Each textbox belongs in one of those cells in the range?
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Registered User
    Join Date
    03-07-2017
    Location
    Stockport, England
    MS-Off Ver
    2007
    Posts
    91

    Re: Add data from userform to specific cells on worksheet

    Hi Arkadi, yes that is correct.

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Add data from userform to specific cells on worksheet

    Ok Mark,

    Something like this then:

    Please Login or Register  to view this content.
    Although you say 4 need entering into the range, so I may be missing some details.
    Last edited by Arkadi; 03-08-2017 at 02:02 PM.

  5. #5
    Registered User
    Join Date
    03-07-2017
    Location
    Stockport, England
    MS-Off Ver
    2007
    Posts
    91

    Re: Add data from userform to specific cells on worksheet

    OK I don't get an error message but nothing happens! As for the 4 items I was hoping to automatically update this in the future to accomodate for multiple address lines. Currently I have left space for only one as it wont be used to post the invoice, just to identify the buyer.

    This is what I have input thus far.

    Private Sub ConfirmClientBtn_Click()

    Dim ws As Worksheet

    Set ws = Worksheets("SalesInvoice") 'change sheet name as needed
    With ws
    .Range("E8").Value = ConfirmedClntName.Text 'replace texbox names with the ones you want to use
    .Range("E9").Value = ConfirmedClntAddr1.Text
    .Range("E10").Value = ConfirmedClntCity.Text
    .Range("E11").Value = ConfirmedClntPcode.Text
    End With

  6. #6
    Registered User
    Join Date
    03-07-2017
    Location
    Stockport, England
    MS-Off Ver
    2007
    Posts
    91

    Re: Add data from userform to specific cells on worksheet

    I think I might need to clear the data and close the form?

  7. #7
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Add data from userform to specific cells on worksheet

    Do the textboxes have something in them when you hit the button? Because if the textbox names are right, I can't see why they won't go to the worksheet.... the code is correct. (Please read the forum rules, especially #3 about using code tags?)

    you don't need to clear data before closing form... .you would put "Unload Me" at the end to have the form close, but still.... the cells should have the values in them regardless of whether you close the form or not.

  8. #8
    Registered User
    Join Date
    03-07-2017
    Location
    Stockport, England
    MS-Off Ver
    2007
    Posts
    91

    Re: Add data from userform to specific cells on worksheet

    Yes they are populated with the addresses pulled from another worksheet. I did have Unload Me but removed it to see if it was causing the problem as it didn't close either when I clicked the command button. I will clean up the module I'm working in as I could have left something that could cause an glitch from previous attempts. Thanks for your help and thanks for pointing me towards the rules.

  9. #9
    Registered User
    Join Date
    03-07-2017
    Location
    Stockport, England
    MS-Off Ver
    2007
    Posts
    91

    Re: Add data from userform to specific cells on worksheet

    Please Login or Register  to view this content.

  10. #10
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Add data from userform to specific cells on worksheet

    No worries... I'd suggest stepping through the code to see if the values are initially placed in the cells, maybe some other code overwrites it? I am happy to look deeper but would need to see the workbook with some sample data (does not have to be real data of course)

  11. #11
    Registered User
    Join Date
    03-07-2017
    Location
    Stockport, England
    MS-Off Ver
    2007
    Posts
    91

    Re: Add data from userform to specific cells on worksheet

    Thanks Arkadi, got to fly now can I send this over tomorrow?

  12. #12
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Add data from userform to specific cells on worksheet

    Yeah of course!

  13. #13
    Registered User
    Join Date
    03-07-2017
    Location
    Stockport, England
    MS-Off Ver
    2007
    Posts
    91

    Re: Add data from userform to specific cells on worksheet

    Hi Arkadi, how do I send this Excel Doc over to you? Via an attachment?

  14. #14
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Add data from userform to specific cells on worksheet

    When posting a message you wil see a button below labelled Go Advanced. If you click that and scroll down a bit you will see a link called Manage Atachments. That will let you select a file and upload it.

  15. #15
    Registered User
    Join Date
    03-07-2017
    Location
    Stockport, England
    MS-Off Ver
    2007
    Posts
    91

    Re: Add data from userform to specific cells on worksheet

    Please find a dummy copy attached with all the code so far for both 1 x module and 1 x userform. Thanks
    Attached Files Attached Files

  16. #16
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Add data from userform to specific cells on worksheet

    Hi Mark,

    The only problem I see with your file is that in the userform code, you have the code for updating the SalesInvoice sheet in a macro called
    "Private Sub ConfirmClientBtn_Click()" the button is not called "ConfirmClientBtn" it is just called "ConfirmClient".
    So either rename the sub by removing "Btn" from it: "ConfirmClient_Click()"
    Or rename the button from ConfirmClient to ConfirmClientBtn

  17. #17
    Registered User
    Join Date
    03-07-2017
    Location
    Stockport, England
    MS-Off Ver
    2007
    Posts
    91

    Re: Add data from userform to specific cells on worksheet

    Any joy, looking at that bit of code Arkadi?

  18. #18
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Add data from userform to specific cells on worksheet

    Yes, did you read my reply? (Post# 16 just above yours). The code is fine from what I see, the name of the macro doesn't match the button name so when the button is hit nothing happens.

  19. #19
    Registered User
    Join Date
    03-07-2017
    Location
    Stockport, England
    MS-Off Ver
    2007
    Posts
    91

    Re: Add data from userform to specific cells on worksheet

    No it wasn't there when I posted. . Another set of eyes makes all the difference, such a simple oversight!!! Thanks so much Arkadi, that solved it!!! On to the next bit. Appreciate the help.

  20. #20
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Add data from userform to specific cells on worksheet

    My pleasure

    Please remember to mark the thread as solved if you are satisfied with the solution? Thanks! and happy coding!

+ 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] Enter data into a userform text box to show in a specific cell in a specific worksheet
    By Stevecraig211 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-10-2016, 10:02 AM
  2. Add data via userform to specific cells
    By gerardgerard in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-14-2015, 09:35 PM
  3. [SOLVED] From UserForm TextBoxes to specific cells on worksheet
    By ScotyB in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-04-2015, 05:41 PM
  4. If Textbox in UserForm contains a specific entry then display data from a worksheet
    By tigerdel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-05-2014, 08:45 AM
  5. Enterkng data on a specific worksheet using a userform command button
    By fbiasi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-29-2014, 11:41 AM
  6. userform - lookup and write data to a specific row in a worksheet
    By EMAP in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-03-2012, 02:01 PM
  7. Transfer specific data on specific worksheet using userform
    By kriscar_44 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-17-2010, 04:03 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