VBA or Formula to create Master Sheet

Status
Not open for further replies.

Excel1991

Board Regular
Joined
Aug 1, 2018
Messages
58
Hello,

I have a workbook with 120 tabs. Each tab has a different different name, but each tab has values in cells w12, x12, y12, z12, aa12 that i would like to get.

Essentially I am trying to create a summary sheet that has the sheet names in column A and then the corresponding values. it would look like this

SHEET NAME10TH%25TH%Median75th%90th%
cardiologycell w12cell x12celly12cell z12cell aa12
dermatologycell w12cell x12cell y12cell z12cell aa12
emergency medicinecell w12cell x12cell y12cell z12cell aa12

<tbody>
</tbody>


I was hoping there was a way to use VBA to first list out all of the sheet names in column A and then go to each sheet and pull the values in cells w12, x12, y12, z12, and aa12. Is this possible? Thanks!
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Does the summary sheet already exist, or does it need to be created?
If it exists, does it already have any data? & should that be over-written?
 
Upvote 0
Ok, how about
Code:
Sub Excel1991()
    Dim ws As Worksheet
    Dim i As Long
    i = 1
    With Sheets("Mastersheet")
        .Range("A1:F1").Value = Array("Sheet name", "10th%", "25th%", "Median", "75%", "90th%")
        For Each ws In Worksheets
            If ws.Name <> .Name Then
                i = i + 1
                .Cells(i, 1).Value = ws.Name
                .Range("B" & i).Resize(, 5).Value = ws.Range("W12:AA12").Value
            End If
        Next ws
    End With
End Sub
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0
You're welcome & thanks for the feedback

Ok, how about
Code:
Sub Excel1991()
    Dim ws As Worksheet
    Dim i As Long
    i = 1
    With Sheets("Mastersheet")
        .Range("A1:F1").Value = Array("Sheet name", "10th%", "25th%", "Median", "75%", "90th%")
        For Each ws In Worksheets
            If ws.Name <> .Name Then
                i = i + 1
                .Cells(i, 1).Value = ws.Name
                .Range("B" & i).Resize(, 5).Value = ws.Range("W12:AA12").Value
            End If
        Next ws
    End With
End Sub
Hello,

I used this code, and updated all the ranges for my own situation, but it is only returning the values for the first row in my data range on each sheet. My data range is "J9:P9" and has varying amounts of rows for each sheet. Any advice on how to modify this for my needs?

Thanks so much!
 
Upvote 0
Duplicate to: VBA loop to collect data from all sheets

In future, please do not post the same question multiple times. Per Forum Rules (#12), posts of a duplicate nature will be locked or deleted.

In relation to your question here, I have closed this thread so please continue in the linked thread.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top