Thread: SUMIF in VBA
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default 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.