Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Can Names refer to Collections?

The important thing is that it works and achieves your objective. In the
final analysis that is what counts.

--

HTH

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

"Jag Man" wrote in message
...

Names are a an Excel property, not VBA. It can refer to a range of

cells,
or
it can be a simple value, but not a collection object, especially as

objects
are destroyed.


Arrays do work, although things have to be copied back and forth.


You are only talking about a transient store anyway, the Name is the
persistent part. Here is another solution that uses an array , and the

Join
and Split methods, so it is Excel 2000 and beyond dependent (unless you
write you own Join and Split functions).


Thanks. I'll give oit a try. A little bit like "serializing" objects for
persistance
in other languages.


Ed


Public Sub Populate()
Dim aCollection
Dim i As Long

ReDim aCollection(0)
For i = 0 To 5
ReDim Preserve aCollection(i)
aCollection(i) = "i" & CStr(i)
Next i
ActiveWorkbook.Names.Add Name:="PersistentData",
RefersTo:=Join(aCollection)

End Sub

Public Sub Retrieve()
Dim aCollection
Dim i As Long

aCollection = Split(Evaluate(Names("PersistentData").RefersTo))
For i = LBound(aCollection) To UBound(aCollection)
Debug.Print aCollection(i)
Next i

End Sub

--

HTH

Bob Phillips





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 to refer to tab names? Rj Excel Discussion (Misc queries) 1 December 21st 09 08:31 AM
some kind of meta-way to refer to sheet and file names in Excel? GoBobbyGo Excel Discussion (Misc queries) 7 February 22nd 06 03:05 PM
Using Collections Kerry[_4_] Excel Programming 1 January 25th 04 04:08 PM
excel calculate problem, (try to refer to defined names?) CornElvis Excel Programming 1 November 18th 03 03:55 AM
Comparing Collections Tom Ogilvy Excel Programming 1 September 17th 03 06:15 PM


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