ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   exel list copying (https://www.excelbanter.com/excel-discussion-misc-queries/87702-exel-list-copying.html)

Marc R Sorger CW

exel list copying
 
How can I print list of exel files names in folder

Jim May

exel list copying
 
In a new Workbook - Sheet1 run the Standard macro

Sub listthefiles()
Cells.ClearContents
Range("A1").Select
Set fs = Application.FileSearch
With fs
..LookIn = "C:\JMay\MyStuff\"
..Filename = "*.xls"
If .Execute 0 Then
For I = 1 To .FoundFiles.Count
ActiveCell.FormulaR1C1 = .FoundFiles(I)
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=RIGHT(RC[-1],LEN(RC[-1])-45)"
ActiveCell.Value = ActiveCell.Value
ActiveCell.Offset(1, -1).Select
Next I
Else
End If
End With
Range("A:A").Delete
Range("A1").Select
End Sub

"Marc R Sorger CW" wrote:

How can I print list of exel files names in folder



All times are GMT +1. The time now is 12:10 AM.

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