Dynamic Array
How can I tell if an array declared initially as myArray() has yet been ReDim'ed?
|
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? |
Dynamic Array
Thanks Chip - already coded that I was hoping for a more elegant solution - oh wel
Thanks again |
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 |
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 |
All times are GMT +1. The time now is 12:10 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com