"Schlieker, Reiner" <reiner.schlieker@siemens.com> wrote:
> I noticed in the example that the To String - Case object was still
> retrieving values from the array. I wonder if it would be faster if the
> text was imbedded in the To String...?
>
> Reiner
Actually slows it down marginally. See below.
Also, since you can do most anything with a formula, I've included
another method that may be of use. It is arguably more elegant since
it is a single object, though is also perhaps more obscure.
Stan
> I noticed in the example that the To String - Case object was still
> retrieving values from the array. I wonder if it would be faster if the
> text was imbedded in the To String...?
>
> Reiner
Actually slows it down marginally. See below.
Also, since you can do most anything with a formula, I've included
another method that may be of use. It is arguably more elegant since
it is a single object, though is also perhaps more obscure.
Stan
-----Original Message-----
From: Brown, Michael L CAR [mailto:Michael.L.Brown@carrier.utc.com]
Sent: 08 May 2003 16:04
To: VEE vrf
Cc: Pickles, Warren
Subject: RE: [vrf] Reading Excel range into VEE
Warren,
Replace
sheet.UsedRange.Value;
with
sheet.UsedRange.Formula;
Then you get a 2-D text array. (See attached.)
Regards,
Michael Brown
-----Original Message-----
From: Pickles, Warren [mailto:Warren.Pickles@tycoelectronics.com]
Sent: Thursday, May 08, 2003 4:15 AM
To: VEE vrf
Subject: [vrf] Reading Excel range into VEE
Hello,
I have attached a small VEE program, adapted from one of the examples, to
illustrate something which has been giving me a headache.
I want to read the contents of an Excel worksheet into VEE, as a 2D array.
I set up a variable called "sheet", which is an object variable of the
worksheet class. Then I use sheet.Usedrange.Value in a formula box.
Sometimes this outputs a 2D array, sometimes a record. The data type of the
output seems to depend on the data in the cells. If the data are all of the
same type, a 2D array is outputted. If the data are of mixed types, ie some
are real numbers, some are text, a record gets outputted. It doesn't matter
if you go into excel and format all the cells as text; if any of them can be
read as numbers you still get a record.
I can't find an easy way to convert the record into a 2D array.
The way around the problem is to loop through the each cell, get its value,
and collect into an array. But there is a time penalty for this, and I will
be working with large sheets.
Any thoughts?
Thanks,
Warren Pickles
<<ExcelProblem.vee>>
---
You are currently subscribed to vrf as: rsb@soco.agilent.com
To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list, email "vrf@it.lists.it.agilent.com".
If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com".
Write Case. Incidentally, I get about the same timings as you do.
My machine is also around 400 MHz.
Michael
-----Original Message-----
From: Stan Bischof [mailto:rsb@soco.agilent.com]
Sent: Thursday, May 08, 2003 3:51 PM
To: VEE vrf
Cc: vrf@it.lists.it.agilent.com; lee.hudson@lumileds.com
Subject: [vrf] RE: Select Case example
The text array method and Write Case method both work well, although the
latter is about four times as fast as the former. (See attached.)
Sincerely,
Michael Brown
interesting. When I run your code on my old slow machine (P3/400 or so)
I consistently get about 2.2ms for the "text array" and 9ms for the write
case.
perhaps you meant to say the 'fromer is about 4 times as fast as the
latter"?
Stan
--------------------------------------------------------------------------
Stan Bischof Agilent Technologies 707-577-3994 stan_bischof@agilent.com
--------------------------------------------------------------------------
---
You are currently subscribed to vrf as: Michael.L.Brown@carrier.utc.com
To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list, email "vrf@it.lists.it.agilent.com".
If you need help with the mailing list send a message to
"owner-vrf@it.lists.it.agilent.com".
---
You are currently subscribed to vrf as: rsb@soco.agilent.com
To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list, email "vrf@it.lists.it.agilent.com".
If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com".
have a better way than using multiple "If/Then/Else" objects?
Select Case i
Case Is = 1
strChartName = "Chart(Mg)"
Case Is = 2
strChartName = "Chart(Si AR)"
Case Is = 3
strChartName = "Chart(Oxygen)"
Case Is = 4
strChartName = "Chart(Carbon)"
Case Is = 5
strChartName = "Chart(XRD - Thickness)"
Case Is = 6
strChartName = "Chart(XRD - %In)"
Case Is = 7
strChartName = "Chart(XRD - ALPeriod)"
Case Is = 8
strChartName = "Chart(PL - Thickness)"
Case Is = 9
strChartName = "Chart(Thickness Range)"
Case Is = 10
strChartName = "Chart(PL - Peak Wavelength)"
Case Is = 11
strChartName = "Chart(PL - PrepPeak Wavelength)"
Case Is = 12
strChartName = "Chart(PL - PrepPeak Range)"
End Select
Thanks,
Lee
*************************
Well- all you need is one If/Then?else object with multiple outputs,
but given your code, simply create a text array with the various
strings in it , and then the case statement just becomes a formula
strChartName=nameList(Is)
where nameList of course contains the strings
To minimize the data in nameList you might want to just list the arguments
strChartName="Chart("+argList(Is)+")"
Stan
--------------------------------------------------------------------------
Stan Bischof Agilent Technologies 707-577-3994 stan_bischof@agilent.com
--------------------------------------------------------------------------
---
You are currently subscribed to vrf as: rsb@soco.agilent.com
To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list, email "vrf@it.lists.it.agilent.com".
If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com".
latter is about four times as fast as the former. (See attached.)
Sincerely,
Michael Brown
interesting. When I run your code on my old slow machine (P3/400 or so)
I consistently get about 2.2ms for the "text array" and 9ms for the write case.
perhaps you meant to say the 'fromer is about 4 times as fast as the latter"?
Stan
--------------------------------------------------------------------------
Stan Bischof Agilent Technologies 707-577-3994 stan_bischof@agilent.com
--------------------------------------------------------------------------
---
You are currently subscribed to vrf as: rsb@soco.agilent.com
To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list, email "vrf@it.lists.it.agilent.com".
If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com".
retrieving values from the array. I wonder if it would be faster if the
text was imbedded in the To String...?
Reiner
-----Original Message-----
From: Brown, Michael L CAR [mailto:Michael.L.Brown@carrier.utc.com]
Sent: Thursday, May 08, 2003 5:17 PM
To: VEE vrf
Cc: lee.hudson@lumileds.com; 'Stan Bischof'
Subject: [vrf] RE: Select Case example
Ooops! You're right. The text array method is 4 times faster than
Write Case. Incidentally, I get about the same timings as you do.
My machine is also around 400 MHz.
Michael
-----Original Message-----
From: Stan Bischof [mailto:rsb@soco.agilent.com]
Sent: Thursday, May 08, 2003 3:51 PM
To: VEE vrf
Cc: vrf@it.lists.it.agilent.com; lee.hudson@lumileds.com
Subject: [vrf] RE: Select Case example
The text array method and Write Case method both work well, although the
latter is about four times as fast as the former. (See attached.)
Sincerely,
Michael Brown
interesting. When I run your code on my old slow machine (P3/400 or so)
I consistently get about 2.2ms for the "text array" and 9ms for the write
case.
perhaps you meant to say the 'fromer is about 4 times as fast as the
latter"?
Stan
--------------------------------------------------------------------------
Stan Bischof Agilent Technologies 707-577-3994 stan_bischof@agilent.com
--------------------------------------------------------------------------
---
You are currently subscribed to vrf as: Michael.L.Brown@carrier.utc.com
To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list, email "vrf@it.lists.it.agilent.com".
If you need help with the mailing list send a message to
"owner-vrf@it.lists.it.agilent.com".
---
You are currently subscribed to vrf as: reiner.schlieker@siemens.com
To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list, email "vrf@it.lists.it.agilent.com".
If you need help with the mailing list send a message to
"owner-vrf@it.lists.it.agilent.com".
---
You are currently subscribed to vrf as: rsb@soco.agilent.com
To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list, email "vrf@it.lists.it.agilent.com".
If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com".