Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default Referring to Microsoft Excel array in VBA

I have a defined name, "MyArray". It refers to the array 4;3;4;3;2;5.
How do I refer to MyArray in VBA code?

TIA,
Alan Beban
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Referring to Microsoft Excel array in VBA

Alan,

How about

Evaluate(Names("myName").RefersTo)

Is this what you want?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Alan Beban" wrote in message
...
I have a defined name, "MyArray". It refers to the array 4;3;4;3;2;5.
How do I refer to MyArray in VBA code?

TIA,
Alan Beban



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Referring to Microsoft Excel array in VBA

I don't follow your 4;3;4;3;2;5, but if you have defined a Name on the
worksheet it is referred simply as:

Range("MyArray")

assuming there are not duplicate names on multiple sheets.
If there are it would be:

Worksheets("MySheet").Range("MyArray")

Now that gets the entire array. If you want each cell separately try:

Set MyList = Range("MyArray")
For each C in MyList
if C.value = "???" Then
'do something
end if
Next

The above cycles through each cell in the array so you can do compares,
assigns, whatever.

TH

On 4/21/04 15:58, in article , "Alan
Beban" wrote:

I have a defined name, "MyArray". It refers to the array 4;3;4;3;2;5.
How do I refer to MyArray in VBA code?

TIA,
Alan Beban


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default Referring to Microsoft Excel array in VBA

Thanks, Bob. That works.

Alan Beban

Bob Phillips wrote:

Alan,

How about

Evaluate(Names("myName").RefersTo)

Is this what you want?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default Referring to Microsoft Excel array in VBA

Thanks for responding; but the response assumes that the name "MyArray"
refers to some range. It doesn't--it refers to the 6-row by 1-column
array with elements 4,3,4,3,2,5, respectively. I.e., click on
Insert|Names|Define; in the Names in Workbook box type MyArray; in the
Refers to box type ={4;3;4;3;2;5}; OK. Now on a worksheet array enter
into a 6-row column =MyArray.

Bob Phillips provided an answer.

Thanks again,
Alan Beban

TH wrote:

I don't follow your 4;3;4;3;2;5, but if you have defined a Name on the
worksheet it is referred simply as:

Range("MyArray")

assuming there are not duplicate names on multiple sheets.
If there are it would be:

Worksheets("MySheet").Range("MyArray")

Now that gets the entire array. If you want each cell separately try:

Set MyList = Range("MyArray")
For each C in MyList
if C.value = "???" Then
'do something
end if
Next

The above cycles through each cell in the array so you can do compares,
assigns, whatever.

TH

On 4/21/04 15:58, in article , "Alan
Beban" wrote:


I have a defined name, "MyArray". It refers to the array 4;3;4;3;2;5.
How do I refer to MyArray in VBA code?

TIA,
Alan Beban





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 968
Default Referring to Microsoft Excel array in VBA

You can also use the simpler:

[myName]

or Evaluate("myName")


regards
Charles
______________________
Decision Models
FastExcel Version 2 now available.
www.DecisionModels.com/FxlV2WhatsNew.htm

"Bob Phillips" wrote in message
...
Alan,

How about

Evaluate(Names("myName").RefersTo)

Is this what you want?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Alan Beban" wrote in message
...
I have a defined name, "MyArray". It refers to the array 4;3;4;3;2;5.
How do I refer to MyArray in VBA code?

TIA,
Alan Beban





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
How can I covert Microsoft Word file into Microsoft Excel one? KatK Excel Discussion (Misc queries) 1 April 3rd 08 04:57 PM
Microsoft Visual Basic errors displaid when opening Microsoft Word 97 & Excel (7 JJ mac Setting up and Configuration of Excel 7 June 14th 07 06:54 PM
Array formulas won't recognize external data from Microsoft Query mmrtech Excel Discussion (Misc queries) 7 December 18th 06 11:31 PM
Change individual cell heights/widths in Microsoft Excel 2000 like Microsoft Word urbanplanner Excel Discussion (Misc queries) 3 December 7th 05 03:57 PM
Microsoft Excel Viewer 2003 won't open Microsoft Excel Worksheet Graham Jones Excel Discussion (Misc queries) 1 May 13th 05 12:58 AM


All times are GMT +1. The time now is 01:31 AM.

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

About Us

"It's about Microsoft Excel"