ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Array of Strings (https://www.excelbanter.com/excel-discussion-misc-queries/98056-array-strings.html)

Zone

Array of Strings
 
I want to set up, for lack of a better term, an array of strings,
evidently a 2-D String array. The number of strings and the number of
characters per string will vary according to conditions. How do I
dimension the array?
Thanks,
James


Ardus Petus

Array of Strings
 
Hi Zone,

Dim myArray(10) as String

Strings are variable length per se.

HTH
--
AP

"Zone" a écrit dans le message de news:
...
I want to set up, for lack of a better term, an array of strings,
evidently a 2-D String array. The number of strings and the number of
characters per string will vary according to conditions. How do I
dimension the array?
Thanks,
James




Zone

Array of Strings
 
Thank you, Ardus. However, I did not make clear what I'm trying to do.
I want the array to hold a set of strings for use as a heading row.
Depending on the value of a cell in the selected row, I insert a
heading row before the selected row and put the correct heading above
each cell in the selected row. It seems very inefficient to use code
like

Select Case cells(activecell.row, "a")
Case "Alba"
myArray(1)="Alba Heading A"
myArray(2)="Alba Heading B"

and so on for 26 headings and 25 cases. I was hoping for a simpler
construct. Maybe I'm stuck with this. Any ideas?
Regards,
James


Ardus Petus wrote:
Hi Zone,

Dim myArray(10) as String

Strings are variable length per se.

HTH
--
AP

"Zone" a écrit dans le message de news:
...
I want to set up, for lack of a better term, an array of strings,
evidently a 2-D String array. The number of strings and the number of
characters per string will vary according to conditions. How do I
dimension the array?
Thanks,
James



Dave Peterson

Array of Strings
 
Maybe...

dim myStrings(1 to 3, 1 to 7) as string

(this would result in a 3x7 array (21 elements))

Zone wrote:

I want to set up, for lack of a better term, an array of strings,
evidently a 2-D String array. The number of strings and the number of
characters per string will vary according to conditions. How do I
dimension the array?
Thanks,
James


--

Dave Peterson


All times are GMT +1. The time now is 02:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com