+ Reply to Thread
Results 1 to 5 of 5

Code for User form to Excel Sheet

  1. #1
    Registered User
    Join Date
    02-10-2014
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    33

    Code for User form to Excel Sheet

    Hi,

    I am trying to learn VBA. I created a Small project with some List and Text Boxes. What I am looking is when the user form is filled with data and I hit the save tab that needs to saved to a sheet in a excel sheet. How do I do that. Any help will be greatly appreciated.
    Attached Files Attached Files

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Code for User form to Excel Sheet

    It's pretty straightforward to transfer data to a worksheet.

    Here's a very simple example.
    Please Login or Register  to view this content.
    Now obviously your setup is a bit more complicated, and the first thing I think you would want to do would be to find the row you wanted to put the data in.

    Assuming that would be the next empty row on the List sheet you could use something like this.
    Please Login or Register  to view this content.
    Now you have the row to put the data in you can use that to put the data from each textbox/combobox in the relevant column.

    For example, to put the value from the textbox APnumber into column A on the next empty row you would use this.
    Please Login or Register  to view this content.
    Similarly for the product texbox.
    Please Login or Register  to view this content.
    So you need similar code for all the relevant textboxes/comboboxes.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    02-10-2014
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Code for User form to Excel Sheet

    Hi Norie,

    I am able to copy it excel however it is over writing the data. Its not getting copied to the next line. Any suggestions on it please.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Code for User form to Excel Sheet

    Can you post what you have now, or upload an updated workbook?

  5. #5
    Registered User
    Join Date
    02-10-2014
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Code for User form to Excel Sheet

    Hi. Thanks for the reply. I am here with attaching my work book. I see when I select data or enter data it is showing in the excel sheet. However it is over writing. What I am looking for is when I hit the save button it should save and I can efresh the form and enter new data. Please help.
    Attached Files Attached Files

+ 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] user form tab index and sort code for sheet 1
    By mezza89 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-07-2014, 08:58 AM
  2. [SOLVED] User form in excel- need help in writing code with if/then statement
    By PANTECH in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-15-2013, 08:04 AM
  3. Can't write code to find last data row in excel user form
    By stevegrobertson in forum Excel General
    Replies: 8
    Last Post: 02-24-2012, 10:16 PM
  4. Excel sheet in User Form
    By Jacques Grobler in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-17-2010, 06:54 AM
  5. [SOLVED] What code do I use to add a user form to Excel worksheet?
    By Hammer1947 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-11-2006, 01:35 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