+ Reply to Thread
Results 1 to 8 of 8

Excel 2007 : Macro to combine data from multiple sheets into one sheet

  1. #1
    Registered User
    Join Date
    03-30-2010
    Location
    South, Florida
    MS-Off Ver
    Excel 2007
    Posts
    18

    Macro to combine data from multiple sheets into one sheet

    Hello All,

    I have about 200 worksheets which are all on seperate tabs within the same workbook. What I would like to do is to write a macro takes the last line of every worksheet starting in column B through f and places that data range in a summary worksheet. The data from the first worksheet can go in cell B1 through F1 of the summary worksheet. The data from the second worksheet will go in cells B2 through F2.

    Can someone help me write a macro?

    Thanks, Bill

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Macro to combine data from multiple sheets into one sheet

    Try this:

    Please Login or Register  to view this content.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Registered User
    Join Date
    03-30-2010
    Location
    South, Florida
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Macro to combine data from multiple sheets into one sheet

    Thanks Dom.

    I have a more remedial question though. In order to use code that you provided, do I go to cell B2 in the summary tab, hit ALT+F11, paste your code, save it and then run it? I tried that and I got an error. I hit the debug command and it highlighted;

    wsEachSheet.Range("B" & Rows.Count).End(xlUp).Resize(1, 5).Copy _
    Sheets("Summary").Range("B" & lngWriteRow)


    I am running Excel 2007.

  4. #4
    Registered User
    Join Date
    03-30-2010
    Location
    South, Florida
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Macro to combine data from multiple sheets into one sheet

    Just worked it out. I need to name the summary sheet "Summary". After that the macro ran but it is only corret for about the first 20 lines or so. I am trying to work out why the other 180 are not right. It is pulling data but not from the last line in the worksheet.

  5. #5
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Macro to combine data from multiple sheets into one sheet

    The macro checks for the last line of the worksheet by working up column B until it finds something. Would column B not always be populated?

    Dom

  6. #6
    Registered User
    Join Date
    03-30-2010
    Location
    South, Florida
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Macro to combine data from multiple sheets into one sheet

    Quote Originally Posted by Domski View Post
    The macro checks for the last line of the worksheet by working up column B until it finds something. Would column B not always be populated?

    Dom
    Dom,

    That makes sense. Unfortunately, many of the worksheets do not have anything (text) populated in column B in the last line; however, all of the spreadsheets do have data populated in column A in the last line. Can the Macro be changed to look for the last line that has data in column A vs B?

  7. #7
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Macro to combine data from multiple sheets into one sheet

    Sure...

    Please Login or Register  to view this content.

    Dom

  8. #8
    Registered User
    Join Date
    03-30-2010
    Location
    South, Florida
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Macro to combine data from multiple sheets into one sheet

    Thanks Dom. Works great!

+ 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