![]() |
Variable used in a =SUMIF() function?
Hi,
How do I replace the "A40" parameter with the nLastrow varable below? nLastrow = 100 objExcel.ActiveSheet.Range("D20").Formula = "=SUMIF (A4:A40,""'5734' "",B4:B40)" I've been trying many things with double-double quotes but nothing works. Thanks. |
Variable used in a =SUMIF() function?
On Sep 10, 1:30*pm, circuit_breaker
wrote: Hi, How do I replace the "A40" parameter with the nLastrow varable below? * nLastrow = 100 * objExcel.ActiveSheet.Range("D20").Formula = "=SUMIF * (A4:A40,""'5734' "",B4:B40)" I've been trying many things with double-double quotes but nothing works. Thanks. This worked: ActiveSheet.Range("D20").formula="=SUMIF(A4:A"&nRo w &",""'5734'"",B4:B41)" |
Variable used in a =SUMIF() function?
objExcel.ActiveSheet.Range("D20").Formula = _
"=SUMIF(A4:A" & nLastRow & ",""'5734' "",B4:B" & nLastRow & ")" -- __________________________________ HTH Bob "circuit_breaker" wrote in message ... Hi, How do I replace the "A40" parameter with the nLastrow varable below? nLastrow = 100 objExcel.ActiveSheet.Range("D20").Formula = "=SUMIF (A4:A40,""'5734' "",B4:B40)" I've been trying many things with double-double quotes but nothing works. Thanks. |
Variable used in a =SUMIF() function?
I'm not sure what you're doing, but even though excel is forgiving, I'd want my
ranges to be the same size. And are you sure you want those single quotes around that 5734? Just in case you want to try it: ActiveSheet.Range("D20").Formula _ = "=SUMIF(A4:A" & nRow & ",""5734"",B4:B" & nRow & ")" circuit_breaker wrote: On Sep 10, 1:30 pm, circuit_breaker wrote: Hi, How do I replace the "A40" parameter with the nLastrow varable below? nLastrow = 100 objExcel.ActiveSheet.Range("D20").Formula = "=SUMIF (A4:A40,""'5734' "",B4:B40)" I've been trying many things with double-double quotes but nothing works. Thanks. This worked: ActiveSheet.Range("D20").formula="=SUMIF(A4:A"&nRo w &",""'5734'"",B4:B41)" -- Dave Peterson |
All times are GMT +1. The time now is 09:53 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com