Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot insert Sumif formula 1

Status
Not open for further replies.
Sep 29, 2003
28
0
0
BY
I need to sum all positive values in column A on Sheet1.Typing
=Sumif(A1:A100;">0") in Formula Bar gives an expected result.

But the code
Sub tst()
ThisWorkbook.Worksheets("Sheet1").Cells(1, 101).Value = "=SUMIF(A1:A100;"">0"")"
End Sub
returns an
"Application-defined or object-defined error"

Something wrong with my code?
 
And this ?
ThisWorkbook.Worksheets("Sheet1").Cells(1, 101).[highlight]Formula[/highlight] = "=SUMIF(A1:A100;"">0"")"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
ThisWorkbook.Worksheets("Sheet1").Cells(1, 101).Formula = "=SUMIF(A1:A100;"">0"")"

Returns the same error :(
 
And this ?
ThisWorkbook.Worksheets("Sheet1").Cells(1, 101).Formula = "=SUMIF(A1:A100[highlight],[/highlight]"">0"")"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
This code

ThisWorkbook.Worksheets("Sheet1").Cells(1, 101).Formula = "=SUMIF(A1:A100,"">0"")"

works. Thanks for help.
 
Tip: use the macrorecorder.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top