Hi All
This is a recorded macro in which there is advanced filter copy cut and paste , together with array formula of index and match and sumproduct from 2 sheets namely workings and Summary report.
Require help to rewrite to a simpler elegant one.
Some adjustments need to be done with a cocktail of formula with advance filter , sumproduct ,index and match, rows still last row of data .
Can anyone help thanks
This is a recorded macro in which there is advanced filter copy cut and paste , together with array formula of index and match and sumproduct from 2 sheets namely workings and Summary report.
Require help to rewrite to a simpler elegant one.
Some adjustments need to be done with a cocktail of formula with advance filter , sumproduct ,index and match, rows still last row of data .
Can anyone help thanks
Code:
Sub uniquetest2()
'
' uniquetest2 Macro
'
'
Range("H1:J1").Select
Range(Selection, Selection.End(xlDown)).Select
Range("H1:J629").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range( _
"AE1:AG1"), Unique:=True ***(to adjust last data row)***
Columns("AE:AG").Select
Columns("AE:AG").EntireColumn.AutoFit
Range("AE1:AG1").Select ***(to adjust last data row)***
Range(Selection, Selection.End(xlDown)).Select
Selection.Cut
Sheets("Summary Report ").Select
Range("A1").Select ***(to adjust last data row)***
ActiveSheet.Paste
Sheets("Workings").Select
Range("X1").Select ***(to adjust last data row)***
Selection.Copy
Range("P1:R1").Select
Application.CutCopyMode = False
Selection.Copy ***(to adjust last data row)***
Sheets("Summary Report ").Select
Range("D1").Select ***(to adjust last data row)***
ActiveSheet.Paste
Sheets("Workings").Select
Range("X1").Select ***(to adjust last data row)***
Application.CutCopyMode = False
Selection.Copy
Sheets("Summary Report ").Select
Range("G1").Select
ActiveSheet.Paste
Range("H1").Select ***(to adjust last data row)***
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "Sequence"
Range("H2").Select ***(to adjust last data row)***
Sheets("Workings").Select
Sheets("Summary Report ").Select ***(to adjust last data row)***
Range("D2").Select
ActiveCell.FormulaR1C1 = _
"=SUMPRODUCT(Workings!R2C[12]:R629C[12],--(Workings!R2C8:R629C8='Summary Report '!RC1),--(Workings!R2C9:R629C9='Summary Report '!RC2),--(Workings!R2C10:R629C10='Summary Report '!RC3))" ***(to adjust last data row)***
Range("D2").Select ***(to adjust last data row)***
Selection.AutoFill Destination:=Range("D2:F2"), Type:=xlFillDefault
Range("D2:F2").Select ***(to adjust last data row)***
Selection.AutoFill Destination:=Range("D2:G2"), Type:=xlFillDefault
Range("D2:G2").Select ***(to adjust last data row)***
Range("G2").Select
ActiveCell.FormulaR1C1 = _
"=SUMPRODUCT(Workings!R2C[17]:R629C[17],--(Workings!R2C8:R629C8='Summary Report '!RC1),--(Workings!R2C9:R629C9='Summary Report '!RC2),--(Workings!R2C10:R629C10='Summary Report '!RC3))"
Range("D2:G2").Select ***(to adjust last data row)***
Selection.AutoFill Destination:=Range("D2:G124") ***(to adjust last data row)***
Range("D2:G124").Select
Range("H2").Select ***(to adjust last data row)***
ActiveCell.FormulaR1C1 = "=ROWS(R2C8:RC)"
Range("H2").Select
Selection.AutoFill Destination:=Range("H2:H124")
Range("H2:H124").Select
Sheets("Workings").Select
Range("Y2").Select
Selection.FormulaArray = _
"=INDEX('Summary Report '!R2C8:R124C8,MATCH(Workings!RC[-17]&Workings!RC[-16]&Workings!RC[-15],'Summary Report '!R2C1:R124C1&'Summary Report '!R2C2:R124C2&'Summary Report '!R2C3:R124C3,0))" ***(to adjust last data row)***
Selection.AutoFill Destination:=Range("Y2:Y629")
Range("Y2:Y629").Select ***(to adjust last data row)***
End Sub