ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SUMIF in VBA (https://www.excelbanter.com/excel-programming/407019-sumif-vba.html)

James C.

SUMIF in VBA
 
Hi,

I am trying to code a SUMIF expression in VBA. I keep getting an error and
was hoping someone could assist.

Here is the formula (not in VBA Code):
=sumif('Annual Data'!Q:Q,"CLT",'Annual Data'!M:M)

I tried this (VBA):
SumIf(Sheets("Annual Data").Range(Q, Q), "CLT", Sheets("Annual
Data").Range(M, M))

Any help would be appreciated.

joel

SUMIF in VBA
 
You range for columns is wrong

SumIf(Sheets("Annual Data").Range("Q:Q"), "CLT", Sheets("Annual
Data").Range("M:M"))


"James C." wrote:

Hi,

I am trying to code a SUMIF expression in VBA. I keep getting an error and
was hoping someone could assist.

Here is the formula (not in VBA Code):
=sumif('Annual Data'!Q:Q,"CLT",'Annual Data'!M:M)

I tried this (VBA):
SumIf(Sheets("Annual Data").Range(Q, Q), "CLT", Sheets("Annual
Data").Range(M, M))

Any help would be appreciated.



All times are GMT +1. The time now is 12:29 PM.

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