View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Variables in Declaring an Array

My typing takes a little to be desired... I should really proof read before
hitting the Post button. You are correct on the String thing. As for the
Array(n) = "that"
it was just a quick n dirty demo. Yes n probably makes more sense...
--
HTH...

Jim Thomlinson


"Gary Keramidas" wrote:

2 things jim

you have a typo he
dim myArray() as sting (string)

and should this be:

array(n) = "that"


--


Gary


"Jim Thomlinson" wrote in message
...
Take a look for help on the redim statement (note the key work preserve is
required to not clear the values of the array when it is resized.)

dim myArray() as sting
dim n as long

n = 0
redim preserve myArray(n)
myarray(0) = "this"
n = 1
redim preserve myarray(n)
myarray(0) = "that"

--
HTH...

Jim Thomlinson


"Jimmy" wrote:

Dim myArray(0 To n) As String

The dimensions of this array change throughout.

Why can't I use the variable 'n' in the declaration?

And, more importantly, can someone help me solve this problem?

Thanks,

Jimmy