+ Reply to Thread
Results 1 to 3 of 3

multiple sheet data merge

Hybrid View

dgclubbie multiple sheet data merge 04-29-2012, 10:14 PM
jindon Re: multiple sheet data merge 04-29-2012, 11:06 PM
dgclubbie Re: multiple sheet data merge 04-30-2012, 12:19 AM
  1. #1
    Registered User
    Join Date
    08-08-2011
    Location
    Queensland, Australia
    MS-Off Ver
    Excel 2010
    Posts
    10

    multiple sheet data merge

    I have a sheet attached, i am trying to merge data from several sheets (30+in fact) and i want to sort the data. In its simplest form I have 2 sites, sheets names site 1 and site 2, and a master sheet. as the inspectors at the site move between the sites inspector a might turn up at site 1 and 2 at different times. On a Site sheet I would like to total all the inspections for each inspector and automatically add new inspectors as they turn up I would like to be able to On the master sheet have an over all total for each inspector regardless of which site.

    the scale of the sample sheet is not relative it is just to outline what I am trying to achieve
    Thanks
    Darren

    Page merge.xlsx

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: multiple sheet data merge

    try
    Sub test()
        Dim ws As Worksheet, r As Range, w, x, i As Long
        With CreateObject("System.Collections.SortedList")
            For Each ws In Worksheets
                If UCase(ws.Name) Like UCase("Site*") Then
                    For Each r In ws.Range("b2", _
                        ws.Range("b" & Rows.Count).End(xlUp))
                        If r.Value <> "" Then
                            If Not .Contains(r.Value) Then
                                ReDim w(1 To 3)
                                w(1) = r.Value
                            Else
                                w = .Item(r.Value)
                            End If
                            w(2) = w(2) + r(, 2).Value
                            w(3) = w(3) + r(, 3).Value
                            .Item(r.Value) = w
                        End If
                    Next
                End If
            Next
            Set x = .Clone
        End With
        With Sheets("master").Cells(1, 1).Resize(, 3)
            .CurrentRegion.ClearContents
            .Value = [{"Inspector","Pass","Fail"}]
            For i = 0 To x.Count - 1
                .Offset(i + 1).Value = x.GetByIndex(i)
            Next
        End With
        Set x = Nothing
    End Sub

  3. #3
    Registered User
    Join Date
    08-08-2011
    Location
    Queensland, Australia
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: multiple sheet data merge

    Thanks Jindon
    That worked so well, thanks for your help

+ 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