View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Testing a string array for any values

Good catch. It would work if the array were variant, but a string array in
initialized to "" for each element I believe.

--
Regards,
Tom Ogilvy

"Dave Peterson" wrote in message
...
I don't think this will work with string arrays:

Dim myArray() As String
ReDim myArray(1 To 5)
MsgBox Application.CountA(myArray)

I got 5 back in the msgbox.



Bob Phillips wrote:

Chris,

You could try

If Application.CountA(ary) 0 Then
'process it
End If

it will fail if there are strings or numbers.

--

HTH

RP
(remove nothere from the email address if mailing direct)

"Chris W." wrote in message
...
Hi,
I have a dynamic, zero-based, string array that I Redim
often, and i want to know how do i test it to see if it
actually has any elements in it before I put it thru the
loop to extract the data. If I have no elements I want to
exit before looping. Can I use IsEmpty to test a string
Array or is it a "" value by default. I forget, and
documentation is sparse on details.

thank you


--

Dave Peterson