ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Strange (?) Evaluate Method Behavior (https://www.excelbanter.com/excel-worksheet-functions/75135-strange-evaluate-method-behavior.html)

Johnny Meredith

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)")


All times are GMT +1. The time now is 01:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com