Strange (?) Evaluate Method Behavior

  • Thread starter Johnny Meredith
  • Start date
J

Johnny Meredith

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',MyDynamicRange2)")
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',MyDynamicRange2)")
Case "foo2"
x = _
.Evauate("=SUMIF(MyDynamicRange1,'foo2',MyDynamicRange2)")
 
Top