Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 113
Default Dynamic Array

How can I tell if an array declared initially as myArray() has yet been ReDim'ed?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Dynamic Array

Dan,

You can test the lower or upper bound and trap the error that
occurs if the array isn't dim'd. E.g,

Dim N As Long
On Error Resume Next
N = LBound(Arr,1)
If Err.Number = 9 Then
Debug.Print "Arr not dim'd"
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"dan" wrote in message
...
How can I tell if an array declared initially as myArray() has

yet been ReDim'ed?


  #3   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 113
Default Dynamic Array

Thanks Chip - already coded that I was hoping for a more elegant solution - oh wel

Thanks again
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default Dynamic Array

Just another idea then...

Sub Demo()
Dim v As Variant
' etc
If Not IsArray(v) Then ReDim v(1 To 10)
End Sub


--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"dan" wrote in message
...
Thanks Chip - already coded that I was hoping for a more elegant

solution - oh well

Thanks again



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default Dynamic Array

OP wrote
--How can I tell if an array declared initially as myArray() has yet
been ReDim'ed?


Dana DeLouis wrote:
Just another idea then...

Sub Demo()
Dim v As Variant
' etc
If Not IsArray(v) Then ReDim v(1 To 10)
End Sub



If it has been ReDim'ed (e.g., 1 to 5) then this code won't disclose that.

Alan Beban

Reply
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
Dynamic Sum Array Formula Input Help excelCPA Excel Discussion (Misc queries) 3 September 25th 09 06:40 PM
Validation list via dynamic array in VBA Brady Excel Discussion (Misc queries) 1 February 8th 07 03:15 PM
How to declare a dynamic array Peter Rooney Excel Discussion (Misc queries) 4 April 13th 05 01:25 PM
see if dynamic array used RobcPettit Excel Programming 2 January 17th 04 12:44 AM
Q: Declaring a dynamic array Srdjan Kovacevic[_4_] Excel Programming 1 January 16th 04 07:24 PM


All times are GMT +1. The time now is 06:40 PM.

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

About Us

"It's about Microsoft Excel"