Thread: sumif in vba
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Robert McCurdy Robert McCurdy is offline
external usenet poster
 
Posts: 102
Default sumif in vba

Hi Robert,

The syntax you have used should work as can the one below:
xt = [SUMIF(teams,Home,power) ]

Check your named ranges to see if the ranges 'teams' and 'power' are the
same dimensions, and 'Home' holds a valid criteria.


Regards
Robert McCurdy
"RobcPettit" wrote in message
...
Hi Im trying to use =(SUMIF(teams,Home,power)) with vba. teams,home
and power are named ranges. The calc works perfect in excel. Ive
tried
Dim xt As Double
xt = Application.WorksheetFunction.SumIf(Range("teams") , Range
("Home"), Range("Power"))
MsgBox xt.

The reason I want to do this is, in excel the calc is dependent on
other data, and when calculated I dont want the value to change, but
because its calc from other data which changes daily the value changes
to, so I thought Id calc using vba and write the value to appropiate
range then when values change this result wont. Basically its the
previous days result.
Thanks Regards Robert