ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dim an Array with a variable (https://www.excelbanter.com/excel-programming/350438-dim-array-variable.html)

icdoo[_7_]

Dim an Array with a variable
 

I need to dim a variable as an array, but I dont know how big to make it
until I found out how much information I will put in it.


..FoundFiles.Count tells me how many values I want to put in the array
but

If I try this I get an error


Dim Maps(1 To .FoundFiles.Count) As String


Is there another way?


--
icdoo
------------------------------------------------------------------------
icdoo's Profile: http://www.excelforum.com/member.php...o&userid=27342
View this thread: http://www.excelforum.com/showthread...hreadid=501347


Bob Phillips[_6_]

Dim an Array with a variable
 
Dim Maps

.. do the Findfile

Redim Maps ( 1 To .FoundFiles.Count)

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"icdoo" wrote in
message ...

I need to dim a variable as an array, but I dont know how big to make it
until I found out how much information I will put in it.


FoundFiles.Count tells me how many values I want to put in the array
but

If I try this I get an error


Dim Maps(1 To .FoundFiles.Count) As String


Is there another way?


--
icdoo
------------------------------------------------------------------------
icdoo's Profile:

http://www.excelforum.com/member.php...o&userid=27342
View this thread: http://www.excelforum.com/showthread...hreadid=501347




Steve Yandl

Dim an Array with a variable
 
Start with
Dim Maps()
and then use ReDim in your procedure once you've determined the size you
need.

Steve


"icdoo" wrote in
message ...

I need to dim a variable as an array, but I dont know how big to make it
until I found out how much information I will put in it.


.FoundFiles.Count tells me how many values I want to put in the array
but

If I try this I get an error


Dim Maps(1 To .FoundFiles.Count) As String


Is there another way?


--
icdoo
------------------------------------------------------------------------
icdoo's Profile:
http://www.excelforum.com/member.php...o&userid=27342
View this thread: http://www.excelforum.com/showthread...hreadid=501347





All times are GMT +1. The time now is 01:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com