Hi,
I have no idea why this won't work. I get an application-defined/object-defined error. I have wsC defined earlier in the code. Range1/2/3 are Defined Name Ranges in the workbook.
Any help is appreciated.
Dim lastrow2, LastColumn As Long
LastColumn = wsC.Cells(2, Columns.Count).End(xlToLeft).Column
lastrow2 = wsC.Cells(Rows.Count, "A").End(xlUp).Row
Range(Cells(3, 26), Cells(lastrow2, LastColumn)).FormulaR1C1 = "=IF(SUMPRODUCT((Range1=Sheet2!$A3)+0,(Range2=Sheet2!Z$2)+0,(Range3))=0,"""",SUMPRODUCT((Range1=Sheet2!$A3)+0,(Range2=Sheet2!AA$2)+0,(Range3))"
I have no idea why this won't work. I get an application-defined/object-defined error. I have wsC defined earlier in the code. Range1/2/3 are Defined Name Ranges in the workbook.
Any help is appreciated.
Dim lastrow2, LastColumn As Long
LastColumn = wsC.Cells(2, Columns.Count).End(xlToLeft).Column
lastrow2 = wsC.Cells(Rows.Count, "A").End(xlUp).Row
Range(Cells(3, 26), Cells(lastrow2, LastColumn)).FormulaR1C1 = "=IF(SUMPRODUCT((Range1=Sheet2!$A3)+0,(Range2=Sheet2!Z$2)+0,(Range3))=0,"""",SUMPRODUCT((Range1=Sheet2!$A3)+0,(Range2=Sheet2!AA$2)+0,(Range3))"