+ Reply to Thread
Results 1 to 8 of 8

Need to copy multiple worksheets and compile date into a master sheet

  1. #1
    Registered User
    Join Date
    01-08-2014
    Location
    RI
    MS-Off Ver
    Excel 2003
    Posts
    4

    Question Need to copy multiple worksheets and compile date into a master sheet

    I'm stuck! I have a workbook that has 7 sheets. "All Sites", which is where I want all my data compiled, and 5 other sheets named, Brookfield, Sudbury, Elkhart, Mishawaka, Walpole, and Site Not Assigned. They are in that order. Each sheet has row 1 with headers in columns A through AJ. All sheets are the same except that the number of rows is different. I only want the rows with data entered to be copied over and appended to the master sheet. I want the master sheet to update automatically any time data is entered into any of the other sheets. Can someone help me?

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,610

    Re: Need to copy multiple worksheets and compile date into a master sheet

    Hi
    you can find some nice code examples at http://www.rondebruin.nl/win/section3.htm which could get you started ( except perhaps the automatic update)

  3. #3
    Registered User
    Join Date
    01-08-2014
    Location
    RI
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Need to copy multiple worksheets and compile date into a master sheet

    None of those seem to work for me.

  4. #4
    Registered User
    Join Date
    01-08-2014
    Location
    RI
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Need to copy multiple worksheets and compile date into a master sheet

    The below seems to work for me. I'm wondering if there is a way to make this so it will automatically update whenever new data is entered into any of the non "mergedata" sheets. Like if the "mergedata" sheet could exist all the time and auto-update. Any ideas?

    Sub MergeData()
    Dim ws As Worksheet, ws1 As Worksheet
    Dim lr As Long, lrm As Long, lc As Integer
    Worksheets.Add(After:=Worksheets(Sheets.Count)).Name = "Merged Data"
    Set ws1 = Sheets("Merged Data")
    For Each ws In Sheets
    If ws.Name <> "Merged Data" Then
    ws.Activate
    lr = ws.Cells(Rows.Count, 1).End(xlUp).Row
    lc = ws.Cells(1, Columns.Count).End(xlToLeft).Column
    If ws1.Range("A1") = "" Then
    Range(Cells(1, 1), Cells(1, lc)).Copy Destination:=ws1.Range("A1")
    End If
    lrm = ws1.Cells(Rows.Count, 1).End(xlUp).Row + 1
    n = lrm
    ws.Activate
    Range(Cells(2, 1), Cells(lr - 1, lc)).Copy Destination:=ws1.Range("A" & lrm)
    ws1.Activate
    lrm = ws1.Cells(Rows.Count, 1).End(xlUp).Row
    Range(Cells(n, lc + 1), Cells(lrm, lc + 1)).Value = ws.Name
    End If
    Next ws
    MsgBox "Data Is Merged Successfully"
    End Sub

  5. #5
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,610

    Re: Need to copy multiple worksheets and compile date into a master sheet

    Quote Originally Posted by cardis01 View Post
    None of those seem to work for me.
    If it does not "seem" maybe it "does" ?

  6. #6
    Registered User
    Join Date
    01-08-2014
    Location
    RI
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Need to copy multiple worksheets and compile date into a master sheet

    Yes. It works but not exactly as I want it to. I lose the formatting that the source sheets have in the newly created Master sheet.

  7. #7
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,610

    Re: Need to copy multiple worksheets and compile date into a master sheet

    OK. I hope there are some bits of the code that can be useful though

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Need to copy multiple worksheets and compile date into a master sheet

    Cardis01

    You need to use code tags with your code as per forum's rule.

    Please Login or Register  to view this content.

+ 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 multiple monthly worksheets to master sheet
    By Malkier in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-15-2014, 02:00 AM
  2. cross populate master sheet with data from multiple worksheets by date
    By irvinkm in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-23-2013, 12:02 PM
  3. 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
  4. Copy from different worksheets to a master sheet
    By svenk in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-25-2009, 10:21 AM
  5. Copy values from multiple worksheets onto one master sheet
    By CGBatch in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-18-2007, 04:46 AM

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