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?
 

RasGhul

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

Forum statistics

Threads
1,082,300
Messages
5,364,386
Members
400,796
Latest member
vrcdesktop

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top