View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
circuit_breaker circuit_breaker is offline
external usenet poster
 
Posts: 13
Default 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)"