Automating pulling data from several sheets into a master sheet

Younis

New Member
Joined
Jun 23, 2015
Messages
4
I helping a friend design a model that consolidate data from several sheets (+6) into a master sheet. His client asked him to design the model so that this process will be automated i.e. the user will fill the data in the input sheets and all the data will be pulled into the master sheet. The data sheets have similar column number and titles but the rows vary in numbers and also has empty between them. I have used the below formula to do this but the formula will not work when I introduce indirect function in it:

INDEX(INDIRECT("RCSA_"&$E36&"_"&$F36&"!$C$25:$CV$502"),AGGREGATE(15,6,(ROW(INDIRECT("RCSA_"&$E36&"_"&$F36&"!$AM$25:$AM$502"))-ROW(INDIRECT("RCSA_"&$E36&"_"&$F36&"!$AM$25"))+1)/(INDIRECT("RCSA_"&$E36&"_"&$F36&"!$AM$25:$AM$502")<>""),ROWS(INDIRECT("RCSA_"&$E36&"_"&$F36&"!AM$25:AM25"))),MATCH('Consolidated RCSAs'!I$35,INDIRECT("RCSA_"&$E36&"_"&$F36&"!$C$22:$CV$22"),0))

Specifically, I am not able to find away to make the range in this indirect function change INDIRECT("RCSA_"&$E36&"_"&$F36&"!AM$25:AM25") as I pull the formula down.

The other issue with the above formula is that it has to automatically start copying from the next sheet once it finished copying all the data in the first sheet and so on.

Can someone help please?
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Hi Younis,

A formula solution would be difficult to make dynamic and maintain, if VBA is ok you can try this.

I'm not sure if it will handle data with blank rows and make sure to test on a sample copy file first;

Insert a Shape on a new sheet called "Master", right click Shape & assign macro

Code:
Sub Rectangle1_Click()

totalsheets = Worksheets.Count
Application.ScreenUpdating = False
        For i = 1 To totalsheets
            If Worksheets(i).Name <> "Master" Then
                lastrow = Worksheets(i).Cells(Rows.Count, 1).End(xlUp).Row
                For j = 2 To lastrow
                Worksheets(i).Activate
                Worksheets(i).Rows(j).Select
                Selection.Copy
                Worksheets("Master").Activate
                lastrow = Worksheets("Master").Cells(Rows.Count, 1).End(xlUp).Row
                Worksheets("Master").Cells(lastrow + 1, 1).Select
                ActiveSheet.Paste
                Sheets("Master").Range("A1").Select
            Next
        End If
Next
Application.ScreenUpdating = True

End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,203
Members
452,617
Latest member
Narendra Babu D

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