View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Johnny Meredith
 
Posts: n/a
Default Strange (?) Evaluate Method Behavior

Hi all,

I looked through the posting, but could not find this exact topic
discussed:

Assume I have defined a 2 dynamic ranges "MyDynamicRange1" &
"MyDynamicRange2". Both of these ranges are parallel to each other and
the same length. If there is no data in the range (which is a
possibility), then the ranges won't exist. When there is data in the
range, the following works as expected:

With Application
x = .Evauate("=SUMIF(MyDynamicRange1,'foo',MyDynamicRa nge2)")
End With

So far so good. If either of the ranges has no data, the wierdness
begins. Take a look at the following code:

Dim x as Variant
'Stuff here
With Application
Select Case strVar
Case "foo"
x = _
.Evauate("=SUMIF(MyDynamicRange1,'foo',MyDynamicRa nge2)")
Case "foo2"
x = _
.Evauate("=SUMIF(MyDynamicRange1,'foo2',MyDynamicR ange2)")