Solved

Querying and Merging Multiple Tabs in Excel into Summary Sheet

Posted on 2014-10-31
9
97 Views
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.

Thoughts?
Weekly-Status-Report.xlsx
0
Comment
Question by:duemes
  • 6
  • 2
9 Comments
 
LVL 46

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)
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40416600
Here's a preliminary solution.
Q-28548548.xlsm
0
 

Author Comment

by:duemes
ID: 40422526
Martin:

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
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
LVL 46

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.
Q-28548548.xlsm
0
 

Author Comment

by:duemes
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!!!
0
 
LVL 46

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.
0
 
LVL 46

Accepted Solution

by:
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 & "'", _
                        TextToDisplay:=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
    Next
    
    Application.ScreenUpdating = True
End Sub

Open in new window

0
 
LVL 46

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.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

770 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