+ Reply to Thread
Results 1 to 5 of 5

Copy Data From Userform Textboxes to Sheet

  1. #1
    Registered User
    Join Date
    07-15-2009
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    77

    Copy Data From Userform Textboxes to Sheet

    Hi

    I have created a user form, with text boxes to capture certain information. This data then needs copying & pasting to another sheet with headers that match the captured data. The user form will be used daily so will always need to paste to the next empty row on sheet 1. I would only want data to submit when i hit the control button I have created in bottom right corner of the form.

    I have read that you can reference in the properties of the text box to a linked cell but I cannot seem to find this anywhere. Is there another way of doing this using code?


    There are also 4 tick boxes to get a yes/no answer. How do i get the relevant tick box to put a yes/no answer in the correct column on sheet 1? ( Columns H & I for reference)


    I have attached the sheet for reference.

    Thanks
    Mark

    Database.xlsm
    Last edited by markrennolds; 03-23-2010 at 03:39 AM. Reason: typo

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: How To Copy Data From User Form Text Boxes to Seperate Sheet

    Here is the basic approach (left some for you to do to learn).

    I would use either a combo box or option buttons in place of the check boxes. I've showed how to use a combo box. Check boxes should be reserved for "yes" or "no" choices (you had the right idea with text) and option buttons or combo boxes used to provide unique selections.

    Note: The "Yes" / "No" selections for the combo box are being added when the form is loaded.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  3. #3
    Registered User
    Join Date
    03-21-2010
    Location
    Adelaide, Australia
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Copy Data From Userform Textboxes to Sheet

    Try this.

    There are notes at the bottom of the code to continue automating the rest of the sheet if you wish.

    Hope it helps.

    Cheers.

    Kym
    Attached Files Attached Files

  4. #4
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Copy Data From Userform Textboxes to Sheet

    kym1901,

    The code you provide does a lot of unnecessary cell activating/selecting/progressive offsetting which is generally not required when using VBA. It also depends on Sheet1 being the active sheet when the user form in invoked - something the OP may not want (seeing as the original WB has other sheets). It is not uncommon to show an input form and keep the data table hidden from users (thought OP doesn't specify this).

    As the code is currently written, both yes and no check boxes may be ticked and this will create an error (code may not fault, but the wrong value may be written to the cell), thus the reason for using either option buttons or combo boxes, list boxes (depending on the number of selectable options required).

  5. #5
    Registered User
    Join Date
    03-21-2010
    Location
    Adelaide, Australia
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Copy Data From Userform Textboxes to Sheet

    Thank you, Palmetto, I am changing my code. I have just started teaching myself and built a couple of forms. What you showed makes it much simpler.
    Cheers.
    Last edited by shg; 03-22-2010 at 10:54 PM. Reason: deleted spurious quote

+ 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