ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   FormulaR1C1 error on a SUMIF (https://www.excelbanter.com/excel-programming/365116-formular1c1-error-sumif.html)

Mike Gallagher[_2_]

FormulaR1C1 error on a SUMIF
 
I am getting an error on the last line of the following:

Selection.AutoFilter Field:=19, Criteria1:="<"
Selection.AutoFilter Field:=1, Criteria1:="1000"
Selection.AutoFilter Field:=4, Criteria1:="<1000", Operator:=xlAnd
ActiveSheet.UsedRange.Select
Selection.Copy
Sheets.Add
Sheets("Sheet1").Activate
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Worksheets("Sheet1").Range("T1").FormulaR1C1 = "comp%"
Worksheets("Sheet1").Range("T2").FormulaR1C1 =
"=SUMIF($D$2:$D$1035,D2,$J$2:$J$1035)"

If I try the code with a simple formula it works. Is there a limitation to
this property or can someone suggest an alternative?


Bob Phillips

FormulaR1C1 error on a SUMIF
 
Worksheets("Sheet1").Range("T2").Formula =
"=SUMIF($D$2:$D$1035,D2,$J$2:$J$1035)"



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Mike Gallagher" wrote in message
...
I am getting an error on the last line of the following:

Selection.AutoFilter Field:=19, Criteria1:="<"
Selection.AutoFilter Field:=1, Criteria1:="1000"
Selection.AutoFilter Field:=4, Criteria1:="<1000", Operator:=xlAnd
ActiveSheet.UsedRange.Select
Selection.Copy
Sheets.Add
Sheets("Sheet1").Activate
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Worksheets("Sheet1").Range("T1").FormulaR1C1 = "comp%"
Worksheets("Sheet1").Range("T2").FormulaR1C1 =
"=SUMIF($D$2:$D$1035,D2,$J$2:$J$1035)"

If I try the code with a simple formula it works. Is there a limitation to
this property or can someone suggest an alternative?





All times are GMT +1. The time now is 09:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com