ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Filename array (https://www.excelbanter.com/excel-programming/362992-re-filename-array.html)

Norman Jones

Filename array
 
Hi Gareth,

Try something like:

'=============
Public Sub Tester()
Dim arr As Variant
Dim i As Long

arr = Array("A.xls", "B.xls", "C.xls", _
"D.xls", "E.xls", "F.xls")

For i = LBound(arr) To UBound(arr)
'Do something, e.g.:
MsgBox arr(i)
Next i

End Sub
'<<=============



---
Regards,
Norman



"pianoman" wrote in
message ...

Hi All,
I need to cycle a set of command for each file in a list... the files
do not share folders, or filename structure or anything, so I really
need to hard-code the filenames in, and then define the next name after
each iteration. What's the best way of doing this... presumably define
an array of names and then cycle that?? How do I do that then?! :)

Thanks, as always,

Gareth


--
pianoman
------------------------------------------------------------------------
pianoman's Profile:
http://www.excelforum.com/member.php...o&userid=33712
View this thread: http://www.excelforum.com/showthread...hreadid=547409





All times are GMT +1. The time now is 12:07 PM.

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