Named array value in a string variable

  • Thread starter Thread starter cubbybear3
  • Start date Start date
C

cubbybear3

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top