• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 121
  • Last Modified:

Querying and Merging Multiple Tabs in Excel into Summary Sheet

See attached excel document.

I'm trying to create a summary tab in a spreadsheet using data that exists in multiple tabs. I'd like this to be dynamic, such as a add new tabs, the summary tabs accounts for the new tab. Also, when I hide the tabs I don't want the summary tab to include it in the summary.

Joshua Dumas
Joshua Dumas
  • 6
  • 2
1 Solution
Martin LissOlder than dirtCommented:
Is a VBA solution OK?

Where do I get the data for the Work Request #?
Is the source for "Project Title" B4?
Is the source for "Project Go-Live Date"  B5? (BTW you have "Anticpated" spelled incorrectly)
Martin LissOlder than dirtCommented:
Here's a preliminary solution.
Joshua DumasAuthor Commented:

I'm so sorry on not getting back to you. I never received an email when you answered this post. You are correct the source for Project Title is B4 and the source for Projected Go-Live Date is B5. As for the Work Request #'s they are gotten from tab names. The tab names then populate the Work Request # field in B3

PS Thanks for letting me know the misspelling of anticipated
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Martin LissOlder than dirtCommented:
I'm not exactly sure what "The tab names then populate the Work Request # field in B3" means but try the attached project. If any field on Summary tab is incorrect please tell me what the value should be.
Joshua DumasAuthor Commented:
Looks great! Exactly what I wanted. Last thing.... anyway on the status page to get the Work Request #'s to link to their appropriate tabs as a hyperlink? Also, I'm going to be adding a new tab lets call it Allocation which I don't want include on this summary tab. I see in the code the following. How would I say don't do this if the sht.Name is "Allocation"

If sht.Visible And sht.Name <> "Summary" Then

Thanks so much for all your help. I've got to tell you. When I envisioned this spreadsheet, this is exactly what I was hoping for - thanks to you!!!
Martin LissOlder than dirtCommented:
Adding hyperlinks always takes me a while since I don't do it very often but I'm working on it.
Martin LissOlder than dirtCommented:
Well that was easier than I thought:)

Here's the code. There are several ways to add another name to the group of sheets that shouldn't be processed, but the Select Case statement is probably the cleanest and easiest to maintain.
Private Sub Worksheet_Activate()

    Dim sht As Worksheet
    Dim lngRow As Long
    lngRow = 3
    Application.ScreenUpdating = False
    ActiveSheet.UsedRange.Cells.Offset(3, 0).ClearContents
    ActiveSheet.ListObjects("Table3").Resize Range("$A$3:$F$4")
    For Each sht In Worksheets
        If sht.Visible Then
            Select Case sht.Name
                Case "Summary", "Allocation"
                    ' Don't process these two sheets
                Case Else
                    lngRow = lngRow + 1
                    With ActiveSheet
'                        Cells(lngRow, 1).Value = sht.Name
                        ' Hyperlink description:
                        ' Anchor: A Range or Shape object to set as the location of the hyperlink.
                        ' Address: The URL to navigate to when the hyperlink is clicked.
                        ' SubAddress: A location on the page. SubAddress is appended to Address and preceded by #.
                        ' ScreenTip: A tool tip to display when the mouse pointer pauses over the hyperlink.
                        ' TextToDisplay: The text to show on screen in place of the hyperlink.
                        .Hyperlinks.Add Anchor:=.Cells(lngRow, 1), _
                        Address:="", _
                        SubAddress:="'" & sht.Name & "'!" & Sheets(sht.Name).Range("A1").Address, _
                        ScreenTip:="Jump to sheet '" & sht.Name & "'", _

                        .Cells(lngRow, 2).Value = sht.Range("B4").Value
                        .Cells(lngRow, 3).Value = sht.Range("B6").Value
                        .Cells(lngRow, 4).Value = sht.Range("B7").Value
                        .Cells(lngRow, 5).Value = sht.Range("B5").Value
                        .Cells(lngRow, 6).Value = sht.Range("G3").Value
                    End With
            End Select
        End If
    Application.ScreenUpdating = True
End Sub

Open in new window

Martin LissOlder than dirtCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 6
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now