SUMIF in VBA

J

James C.

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.
 
J

Joel

You range for columns is wrong

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

loop help 6
Delimma: SumIf worksheet function 0
sumif in vba 2
Variable within a range? 2
Sumif in 3d 4
Change Page Field in a Pivot Table and Print Chart + Data 2
Help with SUMIF in VBA 1
Crafting SUMIF formula 5

Top