Querying and Merging Multiple Tabs in Excel into Summary Sheet

Posted on 2014-10-31
Last Modified: 2014-12-03
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.

Question by:duemes
  • 6
  • 2
LVL 45

Expert Comment

by:Martin Liss
ID: 40416551
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)
LVL 45

Expert Comment

by:Martin Liss
ID: 40416600
Here's a preliminary solution.

Author Comment

ID: 40422526

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
LVL 45

Expert Comment

by:Martin Liss
ID: 40422896
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.
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).


Author Comment

ID: 40423717
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!!!
LVL 45

Expert Comment

by:Martin Liss
ID: 40424411
Adding hyperlinks always takes me a while since I don't do it very often but I'm working on it.
LVL 45

Accepted Solution

Martin Liss earned 500 total points
ID: 40424452
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

LVL 45

Expert Comment

by:Martin Liss
ID: 40478148
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  ( Here (http…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now