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?
 

Some videos you may like

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

RasGhul

Well-known Member
Joined
Jul 15, 2016
Messages
609
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:

Watch MrExcel Video

Forum statistics

Threads
1,099,013
Messages
5,466,026
Members
406,461
Latest member
Garrus

This Week's Hot Topics

Top