Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Getting Value of Array element in Immediate Window
If I have the following code: (Only first three lines shown)
Sub namesheets() Dim arr As Variant arr = Range("A1:A3").Value and I STEP -THROUGH IT (using F8 key) after completing Line 3 I wish to go to my immediate Window and view say ? arr(2).value <<< but this of course is not working Get R/T 9 - subscript out of range.. what should I enter instead? TIA, |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Getting Value of Array element in Immediate Window
It's 2D Jim and there is no Value property
?arr(2,1) -- HTH RP (remove nothere from the email address if mailing direct) "Jim May" wrote in message news:YWKFe.1163$MZ6.59@lakeread01... If I have the following code: (Only first three lines shown) Sub namesheets() Dim arr As Variant arr = Range("A1:A3").Value and I STEP -THROUGH IT (using F8 key) after completing Line 3 I wish to go to my immediate Window and view say ? arr(2).value <<< but this of course is not working Get R/T 9 - subscript out of range.. what should I enter instead? TIA, |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Getting Value of Array element in Immediate Window
? arr(2,1).Value
an array produced this way is always one based and two dimensional. In your case Arr(1 to 3, 1 to 1) -- Regards, Tom Ogilvy "Jim May" wrote in message news:YWKFe.1163$MZ6.59@lakeread01... If I have the following code: (Only first three lines shown) Sub namesheets() Dim arr As Variant arr = Range("A1:A3").Value and I STEP -THROUGH IT (using F8 key) after completing Line 3 I wish to go to my immediate Window and view say ? arr(2).value <<< but this of course is not working Get R/T 9 - subscript out of range.. what should I enter instead? TIA, |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Getting Value of Array element in Immediate Window
Tks Bob
I should remember that in my reading of all this :-) "Bob Phillips" wrote in message ... It's 2D Jim and there is no Value property ?arr(2,1) -- HTH RP (remove nothere from the email address if mailing direct) "Jim May" wrote in message news:YWKFe.1163$MZ6.59@lakeread01... If I have the following code: (Only first three lines shown) Sub namesheets() Dim arr As Variant arr = Range("A1:A3").Value and I STEP -THROUGH IT (using F8 key) after completing Line 3 I wish to go to my immediate Window and view say ? arr(2).value <<< but this of course is not working Get R/T 9 - subscript out of range.. what should I enter instead? TIA, |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Getting Value of Array element in Immediate Window
Put a watch on arr.
You'll see that it's array, but it's a 3x1 array (3 rows x 1 column). So if you used: ?arr(2,1) you'll see a result. And your array isn't a range, so it doesn't have a .value property. Jim May wrote: If I have the following code: (Only first three lines shown) Sub namesheets() Dim arr As Variant arr = Range("A1:A3").Value and I STEP -THROUGH IT (using F8 key) after completing Line 3 I wish to go to my immediate Window and view say ? arr(2).value <<< but this of course is not working Get R/T 9 - subscript out of range.. what should I enter instead? TIA, -- Dave Peterson |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Getting Value of Array element in Immediate Window
Sorry
? arr(2,1).Value should be without the Value ? arr(2,1) -- Regards, Tom Ogilvy "Tom Ogilvy" wrote in message ... ? arr(2,1).Value an array produced this way is always one based and two dimensional. In your case Arr(1 to 3, 1 to 1) -- Regards, Tom Ogilvy "Jim May" wrote in message news:YWKFe.1163$MZ6.59@lakeread01... If I have the following code: (Only first three lines shown) Sub namesheets() Dim arr As Variant arr = Range("A1:A3").Value and I STEP -THROUGH IT (using F8 key) after completing Line 3 I wish to go to my immediate Window and view say ? arr(2).value <<< but this of course is not working Get R/T 9 - subscript out of range.. what should I enter instead? TIA, |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Set array element to empty | Excel Programming | |||
Further Array Element question | Excel Programming | |||
Array Element question | Excel Programming | |||
Array element | Excel Programming | |||
deleting array element | Excel Programming |