compile error: Expected: line number or label or statement o

January 22, 2016 at 15:10:22
Specs: Windows 7
ActiveCell.Offset(0, 5).FormulaR1C1 = "=SUMIF('Item 8 Pg 1'!R4C2:R200C2,Control!R5C7,'Item 8 Pg 1'!R4C10:R200C10)+SUMIF('Item 8 Pg 2'!R4C2:R200C2,Control!R5C7,'Item 8 Pg 2'!R4C10:R200C10)+SUMIF('Item 8 Pg 3'!R4C2:R200C2,Control!R5C7,'Item 8 Pg 3'!R4C10:R200C10)+SUMIF('Item 8 Pg 4'!R4C2:R200C2,Control!R5C7,'Item 8 Pg 4'!R4C10:R200C10)+SUMIF('Item 8 Pg 5'!R4C2:R200C2,Control!R5C7,'Item 8 Pg 5'!R4C10:R200C10)+SUMIF('Item 8 Pg 6'!R4C2:R200C2,Control!R5C7,'Item 8 Pg 6'!R4C10:R200C10)+SUMIF('Item 8 Pg 7'!R4C2:R200C2,Control!R5C7,'Item 8 Pg 7'!R4C10:R200C10)+SUMIF('Item 8 Pg 8'!R4C2:R200C2,Control!R5C7,'Item 8 Pg 8'!R4C10:R200C10)+SUMIF('Item 8 Pg 9'!R4C2:R200C2,Control!R5C7,'Item 8 Pg 9'!R4C10:R200C10)+SUMIF('Item 8 Pg 10'!R4C2:R200C2,Control!R5C7,'Item 8 Pg 10'!R4C10:R200C10)+SUMIF('Item 8 Pg 11'!R4C2:R200C2,Control!R5C7,'Item 8 Pg 11'!R4C10:R200C10) _
+SUMIF('Item 8 Pg 12'!R4C2:R200C2,Control!R5C7,'Item 8 Pg 12'!R4C10:R200C10)+SUMIF(R" & Begrow & "C2:R" & Endrow & "C2,Control!R5C7,R" & Begrow & "C10:R" & Endrow & "C10)"

I'm trying to get the above expression to fit on one line. This code is legacy from an employee who recently left my company. It only went to 11 pages; however, we need it to go to 12 this year. Is there a way to continue the expression onto 2 lines? I tried the space and underscore, but I'm still getting errors. Any help would be very much appreciated! I'm a VBA novice.

Also, the parenthetical statement with Pg 12 in it toward the end of the expression is what I copied from Pg 11. Everything was on one line before I added the sumif for Pg 12. Hopefully there's a way to get the entire quoted statement to work and continue on multiple lines..

message edited by Joshin1389

See More: compile error: Expected: line number or label or statement o

Report •

January 25, 2016 at 01:24:13
Do you have the code as it was before you edited it? that would help as this one is throwing errors. If you have the old one paste that and we will see if we can update it

message edited by AlwaysWillingToLearn

Report •
Related Solutions

Ask Question