Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Named array value in a string variable

As an example, I have a named array "aryXYZ" defined as:
={"abc","456","@#$"} (and yes, I did use Ctrl+Shift+Enter)

I can get the second (or for that matter, any) element/entry into a a
cell with: =INDEX(aryXYZ,2)

What I would like to do is get the value into a string value in a
macro without loading a worksheet cell first. Any hints/clues would
be nice. Thank you. -pb

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Named array value in a string variable

MsgBox ActiveSheet.Evaluate(ActiveWorkbook.Names("test"). RefersTo)(2)

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"cubbybear3" wrote in message
oups.com...
As an example, I have a named array "aryXYZ" defined as:
={"abc","456","@#$"} (and yes, I did use Ctrl+Shift+Enter)

I can get the second (or for that matter, any) element/entry into a a
cell with: =INDEX(aryXYZ,2)

What I would like to do is get the value into a string value in a
macro without loading a worksheet cell first. Any hints/clues would
be nice. Thank you. -pb



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Named array value in a string variable

Thank you Bob. That was just what I needed!!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Named array value in a string variable

Bob, I've tried your idea (for a different purpose) on a defined range that
results in an array and whose RefersTo is in the form of something like:

=IF(datarange=1,"n/a",datarange)

I am then able to use the worksheet INDEX function to reference any item in
the array. However, while I can use VB UBound(Evaluate...RefersTo) to
determine how many items are in the array, I get a "subscript out of range"
error when using Evaluate(...RefersTo)(2) or any index number that plainly
falls between the bounds.

Any ideas?

"Bob Phillips" wrote:

MsgBox ActiveSheet.Evaluate(ActiveWorkbook.Names("test"). RefersTo)(2)

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"cubbybear3" wrote in message
oups.com...
As an example, I have a named array "aryXYZ" defined as:
={"abc","456","@#$"} (and yes, I did use Ctrl+Shift+Enter)

I can get the second (or for that matter, any) element/entry into a a
cell with: =INDEX(aryXYZ,2)

What I would like to do is get the value into a string value in a
macro without loading a worksheet cell first. Any hints/clues would
be nice. Thank you. -pb




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
Trying To Append String Variable To Another String Variable Joe K. Excel Programming 3 October 6th 07 02:11 AM
how to parse string into array or variable? Susan Excel Programming 8 April 3rd 07 08:14 PM
Passing string as array variable (Pivot VBA) klingongardener Excel Discussion (Misc queries) 2 December 23rd 06 07:58 PM
setting a range variable equal to the value of a string variable Pilgrim Excel Programming 2 July 1st 04 11:32 PM
VBA - Convert my variable range array to single cell string Kevin G[_2_] Excel Programming 6 January 28th 04 07:20 AM


All times are GMT +1. The time now is 12:23 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"