mmn1000
Board Regular
- Joined
- Mar 17, 2020
- Messages
- 76
- Office Version
- 2019
- 2013
- Platform
- Windows
Hi,
I list the files in the data folder using the code below
In this code, the list of my files starts from cell F1, for example
I want it to start listing from cell F8 instead of F1
i = i + 1
Cells(i, 6) = fileName
I list the files in the data folder using the code below
VBA Code:
Sub listoffile()
Dim directory As String, fileName As String, sheet As Worksheet, i As Integer
directory = "D:\Data\"
fileName = Dir(directory & "*.*")
Do While fileName <> ""
i = i + 1
Cells(i, 6) = fileName
fileName = Dir()
Loop
End Sub
In this code, the list of my files starts from cell F1, for example
I want it to start listing from cell F8 instead of F1
i = i + 1
Cells(i, 6) = fileName