+ Reply to Thread
Results 1 to 13 of 13

Copy data from one workbook to a master workbook w/ multiple worksheets by a Submit button

  1. #1
    Registered User
    Join Date
    05-21-2013
    Location
    Elkton, MD
    MS-Off Ver
    365
    Posts
    32

    Question Copy data from one workbook to a master workbook w/ multiple worksheets by a Submit button

    Hi, I have been struggling with how to copy data from one workbook to a master workbook that has 4 worksheets. Based on the criteria of Column "G" (29, 50, 75, or 100), I need to have the entire row of data copied into the specific worksheet of the master workbook (the worksheets are already named). The data needs to be pasted on the next blank row of each worksheet. I have a working code for the data to be sent to the master workbook, but do not know how to make the multiple criteria work.

    Also, I need to be able to click the submit button whether the master workbook is opened or closed (right now it is only working when closed.) Any help would be greatly appreciated! Here is what I have so far:

    I am working with excel 2013.

    Please Login or Register  to view this content.
    Last edited by kmclaugh; 07-21-2014 at 07:54 AM. Reason: new excel version

  2. #2
    Forum Contributor mongoose36's Avatar
    Join Date
    06-10-2013
    Location
    Lincoln
    MS-Off Ver
    Excel 2013
    Posts
    389

    Re: Copy data from one workbook to a master workbook w/ multiple worksheets by a Submit bu

    Uploading the workbook you are trying to work with could be helpful.
    If your questions has been answered to your satisfaction please don't forget to do the following:

    Add Reputation ... and ... Mark Thread as Solved

    Thanks,

    Ma 10:8b Freely you have received; freely give.

  3. #3
    Registered User
    Join Date
    05-21-2013
    Location
    Elkton, MD
    MS-Off Ver
    365
    Posts
    32

    Re: Copy data from one workbook to a master workbook w/ multiple worksheets by a Submit bu

    I was afraid you were going to say that:-) I will need to create a sample worksheet and will post as soon as possible. Thanks so much!

  4. #4
    Registered User
    Join Date
    05-21-2013
    Location
    Elkton, MD
    MS-Off Ver
    365
    Posts
    32

    Re: Copy data from one workbook to a master workbook w/ multiple worksheets by a Submit bu

    Here are two workbooks that I am working with. The test worksheet has the submit button that I am trying to use. Once you click the submit button the information needs to be copied to the next blank row in the May Revised Workbook. Based on the criteria in column "G", I need to have the data copied to that specific worksheet. Hopefully this makes sense.

    When opening the worksheets, please select "do not update links". I've tried to remove them, but for some reason I'm failing with that as well! Thanks.
    Attached Files Attached Files

  5. #5
    Forum Contributor mongoose36's Avatar
    Join Date
    06-10-2013
    Location
    Lincoln
    MS-Off Ver
    Excel 2013
    Posts
    389

    Re: Copy data from one workbook to a master workbook w/ multiple worksheets by a Submit bu

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    05-21-2013
    Location
    Elkton, MD
    MS-Off Ver
    365
    Posts
    32

    Re: Copy data from one workbook to a master workbook w/ multiple worksheets by a Submit bu

    Hi Sir, the code works great! Thank you so much...Sooo much shorter than my original code!:-) I'm still stuck with the issue on not knowing how to transfer the data to a different work sheet if the criteria is different in column "G". Also, I would like to be able to use the submit button whether the master workbook is opened or closed.

  7. #7
    Forum Contributor mongoose36's Avatar
    Join Date
    06-10-2013
    Location
    Lincoln
    MS-Off Ver
    Excel 2013
    Posts
    389

    Re: Copy data from one workbook to a master workbook w/ multiple worksheets by a Submit bu

    To answer your first question ... use an if then statement to wrap the equate values command e.g.

    Please Login or Register  to view this content.
    Now the row will only be transferred if G2 = 100 ... you can name any rule you want

    I would like to be able to use the submit button whether the master workbook is opened or closed
    I would do something like the following ...
    Please Login or Register  to view this content.
    To use the above code add the following function to the bottom of the module
    Please Login or Register  to view this content.
    If you would like to close the destination workbook (after the code has run) if it was previously closed and needed to be opened or do nothing if it was already opened this can be done to. Simply insert a variable declared as Boolean after the Workbooks.open command and set it to true ... something like:

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    05-21-2013
    Location
    Elkton, MD
    MS-Off Ver
    365
    Posts
    32

    Re: Copy data from one workbook to a master workbook w/ multiple worksheets by a Submit bu

    Hi, I'm so sorry, but since I am not advanced in vba, I am unsure as to where to put the code. I am getting and error message (sub or function not defined) on the following line:

    Please Login or Register  to view this content.
    Here is my entire code:
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor mongoose36's Avatar
    Join Date
    06-10-2013
    Location
    Lincoln
    MS-Off Ver
    Excel 2013
    Posts
    389

    Re: Copy data from one workbook to a master workbook w/ multiple worksheets by a Submit bu

    Please Login or Register  to view this content.
    contains uses wbDest which has not been set yet. Place the line after the if then statement

  10. #10
    Registered User
    Join Date
    05-21-2013
    Location
    Elkton, MD
    MS-Off Ver
    365
    Posts
    32

    Re: Copy data from one workbook to a master workbook w/ multiple worksheets by a Submit bu

    Hi, I still can not get the code to work for me. Could you please give me the entire code as you think it should be and let me know what and where needs to be changed? I have been working on this for a while and have a deadline to complete by tomorrow. Any help would greatly be appreciated. Thanks.

  11. #11
    Registered User
    Join Date
    05-21-2013
    Location
    Elkton, MD
    MS-Off Ver
    365
    Posts
    32

    Re: Copy data from one workbook to a master workbook w/ multiple worksheets by a Submit bu

    Hi, I am still not able to get my code to work correctly. Could someone please help me understand where I need to add the above code? Should it be placed after the entire if then statements?

    Please Login or Register  to view this content.

  12. #12
    Forum Contributor mongoose36's Avatar
    Join Date
    06-10-2013
    Location
    Lincoln
    MS-Off Ver
    Excel 2013
    Posts
    389

    Re: Copy data from one workbook to a master workbook w/ multiple worksheets by a Submit bu

    Please Login or Register  to view this content.
    bIsBookOpen is a function which tries to set the workbook variable to an "open" workbook. Obviously if the workbook is not open it will return an error. Below is the function which you need to copy and past at the bottom of your module or in an entirely different module....your choice.

    Please Login or Register  to view this content.
    Also
    Please Login or Register  to view this content.
    needs to be changed...I don't think you can declare a worksheet variable to all the worksheets in a workbook. eg
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    05-21-2013
    Location
    Elkton, MD
    MS-Off Ver
    365
    Posts
    32

    Re: Copy data from one workbook to a master workbook w/ multiple worksheets by a Submit bu

    It is finally starting to make sense to me...thank you so much for your patience and guidance. I will rework my code and let you know how I make out! Thanks again for all of your help!

+ 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. Copy/Paste Range of Data from Multiple Workbooks/Worksheets to Master Workbook/Worksheets
    By NumberCruncher311 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-19-2013, 08:21 PM
  2. [SOLVED] Copy cells from multiple worksheets and workbooks to one master workbook
    By Concept in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-30-2012, 01:42 PM
  3. [SOLVED] copy data from multiple worksheets into master workbook
    By geordz in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-10-2012, 07:03 AM
  4. Replies: 3
    Last Post: 01-09-2012, 06:13 AM
  5. updating the master workbook whenever user click submit in check workbook
    By share knowledge in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-11-2011, 10:42 PM

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