+ Reply to Thread
Results 1 to 8 of 8

Copy and Paste Data from Multiple Worksheets into one Worksheet

  1. #1
    Registered User
    Join Date
    07-26-2006
    MS-Off Ver
    Office 365
    Posts
    97

    Copy and Paste Data from Multiple Worksheets into one Worksheet

    Hello,
    I have a project that right now requires a lot of copying and pasting of similar data sheets into one master sheet. When my data is exported from our accounting software, each “lot” is exported onto a separate sheet. I may have up to 100 sheets in one workbook.
    The data exports into Excel in a very predictable format with the columns and data always aligning (data range is always between A:H for example). The trick is the number of rows will always change with each “lot”.

    I would like to get a macro that will find the range in each sheet and copy the data onto a “master” sheet, then go to the next sheet, find the full range copy that data and then paste to the master, below the previous data. It would continue to do this until it has copied it from all sheets. I would put the Master sheet on the left and then have the macro move left to right looking in each next sheet.

    For example of the output, See the attached workbook and the “Master” sheet.
    The copy and paste does not have to be pretty as I can clean the data later. But all the data on one sheet, with the columns lined up is my goal.
    Any feedback helps. Thank you in advance.
    Attached Files Attached Files

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Copy and Paste Data from Multiple Worksheets into one Worksheet

    This assumes that your master worksheet is named Master as shown in the example link.

    Please Login or Register  to view this content.
    The code should be copied to the standard code module1.
    Last edited by JLGWhiz; 02-21-2019 at 06:48 PM.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Registered User
    Join Date
    07-26-2006
    MS-Off Ver
    Office 365
    Posts
    97

    Re: Copy and Paste Data from Multiple Worksheets into one Worksheet

    Hey JLGWhiz. Thank you for such a quick reply. I tried the macro but it throws a Run-time error '91': Object Variable or With Block variable not set. I've attached the model. The error may be on my end. I put it in Module 1 but unsure if I did it correctly. Thank you again.
    Attached Files Attached Files

  4. #4
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Copy and Paste Data from Multiple Worksheets into one Worksheet

    Sorrry about that, forgot to accomodate blank sheets.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-26-2006
    MS-Off Ver
    Office 365
    Posts
    97

    Re: Copy and Paste Data from Multiple Worksheets into one Worksheet

    Hi Again JLGWhiz,
    I was able to get it to run, but only partially. It seems to skip some sheets (not sure why) and some sheets it only returns the last row. What is also peculiar is that it starts populating the Master sheet on row 26. I've attached the full workbook I am using with confidential info removed so you have a better idea of what I am working with. Thank you again for your time.
    Attached Files Attached Files

  6. #6
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Copy and Paste Data from Multiple Worksheets into one Worksheet

    My fault, I had the calculation for the last row on the wrong sheet. This should now work.

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    07-26-2006
    MS-Off Ver
    Office 365
    Posts
    97

    Re: Copy and Paste Data from Multiple Worksheets into one Worksheet

    It works! That is a thing of beauty! Thank you for all your help!

  8. #8
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Copy and Paste Data from Multiple Worksheets into one Worksheet

    Quote Originally Posted by Cardan View Post
    It works! That is a thing of beauty! Thank you for all your help!
    You are welcome,
    regards, JLG

+ 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] Copy data rows from multiple worksheets, paste into one worksheet
    By jokris in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-20-2016, 08:59 AM
  2. Copy/Paste Columns from Multiple Worksheets based on Headers into new Worksheet
    By casper3043 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-01-2015, 03:06 PM
  3. [SOLVED] (Excel VBA) Copy and Paste from one worksheet to multiple worksheets by names
    By road_warrior in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-30-2015, 08:40 PM
  4. [SOLVED] Copy multiple worksheets data & paste into blank columns in summary worksheet
    By guest99999 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-21-2013, 09:56 AM
  5. 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
  6. [SOLVED] Search multiple worksheets for Text String, copy and paste entire row into new worksheet
    By spulliam2000 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-15-2013, 07:52 PM
  7. Copy data from multiple worksheets & paste into one worksheet.
    By Rodders in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-10-2012, 11:54 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