J
JMay
The following code to perform quite well with the exception that it is
Occasionally **Duplicating** certain (several) files in the listing, as
follows:
c:\windows\desktop\temp excel formulas\CountIf_Array_Usage.xls
c:\windows\desktop\Temp excel formulas\CountIf_Array_Usage.xls
c:\windows\desktop\temp excel formulas\CountIf_Array_Usage.xls
Any clues as to what's going on and how to eliminate duplication?
TIA,
JMay
Sub listthefiles()
Set fs = Application.FileSearch
With fs
..LookIn = "C:\Windows\Desktop\Temp Excel Formulas"
..Filename = "*.xls"
If .Execute > 0 Then
ActiveCell = Range("A2")
For I = 1 To .FoundFiles.Count
ActiveCell.FormulaR1C1 = .FoundFiles(I)
ActiveCell.Offset(1, 0).Select
Next I
Else
End If
End With
End Sub
Occasionally **Duplicating** certain (several) files in the listing, as
follows:
c:\windows\desktop\temp excel formulas\CountIf_Array_Usage.xls
c:\windows\desktop\Temp excel formulas\CountIf_Array_Usage.xls
c:\windows\desktop\temp excel formulas\CountIf_Array_Usage.xls
Any clues as to what's going on and how to eliminate duplication?
TIA,
JMay
Sub listthefiles()
Set fs = Application.FileSearch
With fs
..LookIn = "C:\Windows\Desktop\Temp Excel Formulas"
..Filename = "*.xls"
If .Execute > 0 Then
ActiveCell = Range("A2")
For I = 1 To .FoundFiles.Count
ActiveCell.FormulaR1C1 = .FoundFiles(I)
ActiveCell.Offset(1, 0).Select
Next I
Else
End If
End With
End Sub