+ Reply to Thread
Results 1 to 6 of 6

VBA to click button and transfer userform data to another workbook

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-07-2014
    Posts
    218

    VBA to click button and transfer userform data to another workbook

    Hello Excel pros and enthusiasts, I would appreciate your help with some VBA please.

    I have two workbooks attached. In the workbook named "Data Entry Form", if you open it and click the Open Form button, you will get a userform with four fields and an Enter Data command button. I would like to use the drop downs and free text etc and enter data, then click the command button (Enter Data). When I click the command button I want the below activities to take place:

    1. Open workbook called "Database"
    2. Write the data from the four userform fields from "Data Entry Form" to the next empty row on the "Database" workbook
    3. Save "Database" workbook
    4. Close "Database" workbook

    I have already inserted the headers on the "Database" workbook in Row 1 as you will see.

    Can you please help me to get the VBA code for the "Enter Data" command button to perform the above task?

    Assume the path for the "Database" workbook is as shown below:

    C:\Users\ComputerDesk\Desktop\receiptofdeliveries\Database.xlsm

    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    09-28-2014
    Location
    harbin,china
    MS-Off Ver
    2007
    Posts
    162

    Re: VBA to click button and transfer userform data to another workbook

    If this can help you, please consider adding my reputation.
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    06-07-2014
    Posts
    218

    Re: VBA to click button and transfer userform data to another workbook

    simcode, you answered my question 100% correct. Thank you very much. I have added the reputation. Appreciated.

    Regarding the the VBA you created for my solution, can you recommend a book that teaches this principle and other principles similar to this?

  4. #4
    Forum Contributor
    Join Date
    06-07-2014
    Posts
    218

    Re: VBA to click button and transfer userform data to another workbook

    Hi simcode, I need your help again. I have added a listbox on the attached which can be accessed by clicking on the button. I want the listbox to pull information from the "Database" workbook to populate the listbox

    I would like to use the "From a closed workbook that is opened and closed again" format as per the instructions in the below?

    http://www.erlandsendata.no/english/...ogslistboxfill

    Thanks!
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    09-28-2014
    Location
    harbin,china
    MS-Off Ver
    2007
    Posts
    162

    Re: VBA to click button and transfer userform data to another workbook

    I have no clear idea about your database size. If it has lots of data, maybe it's a good idea to use ADO.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    06-07-2014
    Posts
    218

    Re: VBA to click button and transfer userform data to another workbook

    simcode, your above worked well also. I want to try and learn the fundamentals of this and will post here again if I run into issues. I will mark this as solved. Thanks again!

+ 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. Transfer data from userform to a seperate workbook
    By sn152 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-16-2014, 11:39 AM
  2. Replies: 0
    Last Post: 05-05-2014, 11:06 AM
  3. Error on userform remove button click
    By gsurge in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 10-11-2012, 08:45 AM
  4. [SOLVED] Close userform with submit button click
    By mrapes in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-08-2012, 11:53 AM
  5. UserForm, update after command button click
    By ker9 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-01-2010, 01:05 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