Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default The equivalence of EQUIVALENCE

I've read elsewhere in this group that a construct like Fortran's
EQUIVALENCE doesn't exist in VBA, so let me please share the goal and
perhaps someone has a suggestion. I want to access certain elements of
an array by individual names. This is mostly for clarity of
programming, bug avoidance, etc. The array construct is necessary
because several operations have to be done on the array as a whole,
but writing and reading portions of it would be much easier to
document for those who follow if the individual elements had
meaningful variable names like tempLosAngeles instead of temp(6,9,7).
All bright ideas appreciated, and thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default The equivalence of EQUIVALENCE

Richard,

Maybe you could use a collection, which allows you to define a key for each
member.

hth,

Doug Glancy

"Richard" wrote in message
om...
I've read elsewhere in this group that a construct like Fortran's
EQUIVALENCE doesn't exist in VBA, so let me please share the goal and
perhaps someone has a suggestion. I want to access certain elements of
an array by individual names. This is mostly for clarity of
programming, bug avoidance, etc. The array construct is necessary
because several operations have to be done on the array as a whole,
but writing and reading portions of it would be much easier to
document for those who follow if the individual elements had
meaningful variable names like tempLosAngeles instead of temp(6,9,7).
All bright ideas appreciated, and thanks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 593
Default The equivalence of EQUIVALENCE

"Doug Glancy" wrote ...

I've read elsewhere in this group that a construct like Fortran's
EQUIVALENCE doesn't exist in VBA, so let me please share the goal and
perhaps someone has a suggestion. I want to access certain elements of
an array by individual names. This is mostly for clarity of
programming, bug avoidance, etc. The array construct is necessary
because several operations have to be done on the array as a whole,
but writing and reading portions of it would be much easier to
document for those who follow if the individual elements had
meaningful variable names like tempLosAngeles instead of temp(6,9,7).


Maybe you could use a collection, which allows you to define a key for each
member.


What a great title for a post!

The trouble with a Collection is that is impossible AFAIK to retrieve
the keys. I'm told this is possible with the scripting Dictionary
object, which also offers additional methods.

However, both a Collection and a Dictionary are essentially one
dimensional. So, when I need something more capable than a Collection,
I use a fabricated (disconnected) ADO Recordset, which has some very
useful properties and methods (Sort, Filter, GetRows, etc). Records
and Fields = 2D of course but another dimension may be added eith by
using key columns or even by fabricating a hierarchical recordset
(i.e. a recordset of recordsets) using the SHAPE provider and syntax.
There are some articles on MSDN e.g.

http://support.microsoft.com/default...b;en-us;196029

Jamie.

--
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
Formula to check two rows for equivalence Eric_NY Excel Discussion (Misc queries) 3 April 3rd 09 12:17 AM
String equivalence Martina Excel Worksheet Functions 5 May 25th 07 07:06 AM
Page Setup Margin Value Equivalence in cm AJ Excel Discussion (Misc queries) 1 May 14th 07 05:33 PM
VBA equivalence tp to DOS "echo off" brian Excel Discussion (Misc queries) 3 September 15th 06 02:29 AM
Equivalence of two sets of data vsoler Excel Discussion (Misc queries) 4 April 18th 06 06:08 PM


All times are GMT +1. The time now is 09:42 PM.

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"