I am having trouble with writing a macro that could consolidate specific data range R10C1:R26C2 from multiple sheets in active workbook as i have to write macro physically for lets say 14 sheets as you can see from example. is there a way where the macro can pick any number of sheets within the active workbook within that data range and consolidate the data( i need to sum the data within the data range). And also i have to paste the same formula 3 times to make sure that headings of the tables (top row) and left row gets copied properly. Please help me, any help would be much appreciated.
Sub Macro15()
Sheets.Add
ActiveSheet.Select
Range("A1").Select
Selection.Consolidate Sources:=Array("Sheet4!R10C1:R26C2", "Sheet4 (2)!R10C1:R26C2", "Sheet4 (3)!R10C1:R26C2", "Sheet4 (4)!R10C1:R26C2", "Sheet4 (5)!R10C1:R26C2", "Sheet4 (6)!R10C1:R26C2", "Sheet4 (7)!R10C1:R26C2", "Sheet4 (8)!R10C1:R26C2", "Sheet4 (9)!R10C1:R26C2", "Sheet4 (10)!R10C1:R26C2", "Sheet4 (11)!R10C1:R26C2", "Sheet4 (12)!R10C1:R26C2", "Sheet4 (13)!R10C1:R26C2", "Sheet4 (14)!R10C1:R26C2"), _
Function:=xlSum, TopRow:=True, LeftColumn:=True, CreateLinks:=False
Selection.Consolidate Sources:=Array("Sheet4!R10C1:R26C2", "Sheet4 (2)!R10C1:R26C2", "Sheet4 (3)!R10C1:R26C2", "Sheet4 (4)!R10C1:R26C2", "Sheet4 (5)!R10C1:R26C2", "Sheet4 (6)!R10C1:R26C2", "Sheet4 (7)!R10C1:R26C2", "Sheet4 (8)!R10C1:R26C2", "Sheet4 (9)!R10C1:R26C2", "Sheet4 (10)!R10C1:R26C2", "Sheet4 (11)!R10C1:R26C2", "Sheet4 (12)!R10C1:R26C2", "Sheet4 (13)!R10C1:R26C2", "Sheet4 (14)!R10C1:R26C2"), _
Function:=xlSum, TopRow:=True, LeftColumn:=False, CreateLinks:=False
Selection.Consolidate Sources:=Array("Sheet4!R10C1:R26C2", "Sheet4 (2)!R10C1:R26C2", "Sheet4 (3)!R10C1:R26C2", "Sheet4 (4)!R10C1:R26C2", "Sheet4 (5)!R10C1:R26C2", "Sheet4 (6)!R10C1:R26C2", "Sheet4 (7)!R10C1:R26C2", "Sheet4 (8)!R10C1:R26C2", "Sheet4 (9)!R10C1:R26C2", "Sheet4 (10)!R10C1:R26C2", "Sheet4 (11)!R10C1:R26C2", "Sheet4 (12)!R10C1:R26C2", "Sheet4 (13)!R10C1:R26C2", "Sheet4 (14)!R10C1:R26C2"), _
Function:=xlSum, TopRow:=True, LeftColumn:=True, CreateLinks:=False
ActiveWindow.SmallScroll Down:=-228
Columns("A:A").ColumnWidth = 23.88
Columns("A:A").ColumnWidth = 41.25
Columns("A:A").ColumnWidth = 47.88
Columns("B:B").ColumnWidth = 16.5
End Sub