Automating pulling data from several sheets into a master sheet


New Member
Jun 23, 2015
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?

Some videos you may like

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand


Well-known Member
Jul 15, 2016
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

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
                lastrow = Worksheets("Master").Cells(Rows.Count, 1).End(xlUp).Row
                Worksheets("Master").Cells(lastrow + 1, 1).Select
        End If
Application.ScreenUpdating = True

End Sub
Last edited:

Watch MrExcel Video

Forum statistics

Latest member

This Week's Hot Topics

  • Timer in VBA - Stop, Start, Pause and Reset
    [CODE=vba][/CODE] Option Explicit Dim CmdStop As Boolean Dim Paused As Boolean Dim Start Dim TimerValue As Date Dim pausedTime As Date Sub...
  • how to updates multiple rows in muliselect listbox
    Hello everyone. I need help with below code. code is only chaning 1st row in mulitiselect list box. i know issue with code...
  • Delete Row from Table
    I am trying to delete a row from a table using VBA using a named range to find what I need to delete. My Range is finding the right cell. In the...
  • Assigning to a variable
    I have a for each block where I want to assign the value in column 5 of the found row to the variable Serv. [CODE=vba] For Each ws In...
  • Way to verify information
    Hi All, I don't know what to call this formula, and therefore can't search. I have a spreadsheet with information I want to reference...
  • Active Cell Address – Inactive Sheet
    How to use VBA to get the cell address of the active cell in an inactive worksheet and then place that cell address in a location on the current...