Hi All
I have a work tab and a summary tab , the summary tab represent the consolidation of columns in green using sumifs
I recorded a macro how the figures are consolidated from column range S TO U then column AC ON SUMMARY sheet tab as per their respective headers .
The range is dynamic as it can lead to 10000 rows or more .
Looking assistance to adjust recorded macro to last data row making it dynamic .
The active sheet should be the summary tab sheet when code is triggered
Sub TESTSUMIFS11()
'
' TESTSUMIFS11 Macro
'
'
ActiveCell.FormulaR1C1 = _
"=SUMIFS(WORK!R2C19:R58C19,WORK!R2C8:R58C8,SUMMARY!RC1,WORK!R2C9:R58C9,SUMMARY!RC2,WORK!R2C11:R58C11,SUMMARY!RC3)"
Range("D2").Select
Selection.AutoFill Destination:=Range("D2:D20"), Type:=xlFillDefault
Range("D2:D20").Select
Range("E2").Select
ActiveCell.FormulaR1C1 = _
"=SUMIFS(WORK!R2C20:R58C20,WORK!R2C8:R58C8,SUMMARY!RC1,WORK!R2C9:R58C9,SUMMARY!RC2,WORK!R2C11:R58C11,SUMMARY!RC3)"
Range("E2").Select
Selection.AutoFill Destination:=Range("E2:E20"), Type:=xlFillDefault
Range("E2:E20").Select
Range("F2").Select
ActiveCell.FormulaR1C1 = _
"=SUMIFS(WORK!R2C21:R58C21,WORK!R2C8:R58C8,SUMMARY!RC1,WORK!R2C9:R58C9,SUMMARY!RC2,WORK!R2C11:R58C11,SUMMARY!RC3)"
Range("F2").Select
Selection.AutoFill Destination:=Range("F2:F20"), Type:=xlFillDefault
Range("F2:F20").Select
Range("G2").Select
ActiveCell.FormulaR1C1 = _
"=SUMIFS(WORK!R2C22:R58C22,WORK!R2C8:R58C8,SUMMARY!RC1,WORK!R2C9:R58C9,SUMMARY!RC2,WORK!R2C11:R58C11,SUMMARY!RC3)"
Range("G2").Select
Selection.AutoFill Destination:=Range("G2:G20")
Range("G2:G20").Select
Range("H2").Select
ActiveCell.FormulaR1C1 = _
"=SUMIFS(WORK!R2C29:R58C29,WORK!R2C8:R58C8,SUMMARY!RC1,WORK!R2C9:R58C9,SUMMARY!RC2,WORK!R2C11:R58C11,SUMMARY!RC3)"
Range("H2").Select
Selection.AutoFill Destination:=Range("H2:H20"), Type:=xlFillDefault
Range("H2:H20").Select
Range("D21:H21").Select
Selection.FormulaR1C1 = "=SUM(R[-19]C:R[-1]C)"
End Sub
Bookmarks