Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Set array element to empty Raul Excel Programming 2 March 2nd 05 03:53 PM
Further Array Element question S G Booth Excel Programming 2 February 25th 05 03:54 PM
Array Element question S G Booth Excel Programming 5 February 23rd 05 09:59 PM
Array element Andrea[_8_] Excel Programming 5 December 7th 04 08:24 PM
deleting array element michael Excel Programming 0 December 18th 03 08:55 PM


All times are GMT +1. The time now is 02:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"