Home |
Search |
Today's Posts |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If in Excel 2000 or later:
Sub ListfilesInDirectory() Dim direc Dim fs As Variant Dim LooKin As Validation Dim FileName As Variant Dim i As Integer 'direc = Range("ad2") direc = "C:\Data" Sheets("Test").Select Range("a1").Select Set fs = Application.FileSearch With fs .Lookin = direc .FileName = ".xls" If .Execute 0 Then For i = 1 To .FoundFiles.Count varr = Slit(.Foundfiles(i),"\") ActiveCell.FormulaR1C1 = varr(ubound(varr)) ActiveCell.Offset(1, 0).Select Next i Else End If End With End Sub -- Regards, Tom Ogilvy "Geno" wrote in message ... Thanx a lot, now how do I eliminate the directory name and simply display the filenames? -- Geno ------------------------------------------------------------------------ Geno's Profile: http://www.excelforum.com/member.php...o&userid=16380 View this thread: http://www.excelforum.com/showthread...hreadid=214248 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can I change list into a directory format? | Excel Worksheet Functions | |||
List of Files in A Directory | Excel Discussion (Misc queries) | |||
list directory in EXCEL | Excel Discussion (Misc queries) | |||
List of folders in a certain directory | Excel Discussion (Misc queries) | |||
list box- list all files ina directory | Excel Programming |