exel list copying

  • Thread starter Thread starter Guest
  • Start date Start date
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top