LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 345
Default Test Initialization of an Array

If an array is originally dim'd as: TestAy() as whatever
I can't find a way, in a subsequent macro where TestAy() is an argument,
to directly test whether or not it has been re-dim'd.

I have two macros, the first has a string array that is dim'd without
boundaries.

dim TestAy() as string

IF sub MacroOne puts values into it, I use:

redim TestAy(1 to Quantity) ' and then fill it with values.

Now, MacroTwo is called

call MacroTwo(TestAy())

sub MacroTwo(TestAy() as string)
' I've tried different ways, but keep getting subscript errors, when I try
to
' test whether or not TestAy has values without also creating and
' passing another argument showing whether or not TestAy was
' redim'd in MacroOne. Some examples follow of stuff that didn't work
' when MacroOne did NOT redim TestAy.
' NOTE: I'm looking for a direct way, if it exists, to learn. I know that
' I could redim TestAy(1) in MacroOne and then in MacroTwo test
' TestAy(1) to see what it contained.

if lbound(TestAy) 0 then ..... ' errors out if not dimmed

dim Number
number = vartype(TestAy) ' tells me it's an array but no boundaries

Dim holdARRAY
holdARRAY = Array(TestAy)
MsgBox LBound(holdARRAY(1)) 'errors out if TestAy not redim'd.

end sub

Thanks for your help.

--
Neal Z
 
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
Can I test dynamic array for empty? LabElf Excel Programming 7 November 11th 05 06:04 PM
Can't test for Empty objects in an array Peter Chatterton[_4_] Excel Programming 3 July 28th 05 07:06 AM
Test for dups in Array Perico[_2_] Excel Programming 5 July 14th 05 09:51 AM
Array Test VBA Dabbler[_2_] Excel Programming 9 March 30th 05 09:53 PM
Test for end of array of objects? peter Excel Programming 8 February 3rd 05 09:15 AM


All times are GMT +1. The time now is 12:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"