Thread: Empty Array
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
ExcelMonkey[_190_] ExcelMonkey[_190_] is offline
external usenet poster
 
Posts: 172
Default Empty Array

Dho! Thank-you. I think I spent an an hour staring at
this last night trying to figure out why it wasn't
working. I knew it was something obvious. thanks again
Tom. I am starting to see the light at the end of this
programming tunnel - for now!

Thanks


-----Original Message-----
You said:

The array is public,
initially has data, have not declared a variable twice.


and then in the first 3 lines, you declare it twice:

Public ObjCollArray As String

Private Sub OKButton_Click()
Dim ObjCollArray(0 To 6)

The array in OKButton_Click is a local variable and is

not the same as you
your public variable with the same name.

If you are doing all this in you userform module, then

you would need to do

Public ObjCollArray As Variant

Private Sub OKButton_Click()
ReDim ObjCollArray(0 To 6)

then you would need to do

ObjFind = Application.Index(ObjCollArray, _
1, ChkbxCtrlFind)

since this is a single row array.

Note that if I want the first element of ObjCollArray,

then ChkbxCtrlFind
would need to have a value of 1, not zero.

--
Regards,
Tom Ogilvy

"ExcelMonkey" wrote

in message
...
That creates a new error.

-----Original Message-----
Hi
Could be wrong here, but would you not do

Public ObjCollArray() as string

and then inside the sub

Redim ObjCollArray(0 to 6)

regards
Paul

.



.