Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 90189

Sequential reading of file names in a folder using excel VBA

$
0
0

I am trying to read nearly 1000 files in a folder using VBA. I wish the code to pick the file name in an incremental order such as Dummy3_1, Dummy3_2, Dummy3_3, etc. But instead, the current code picks Dummy3_10 after Dummy3_1. How I could make the code to read the file name sequentially. Thanks

Application.ScreenUpdating = False
    With Application.FileDialog(msoFileDialogFolderPicker)
        .Title = "Please select a folder"
        .ButtonName = "Pick Folder"
        If .Show = 0 Then
            MsgBox "Nothing was selected"
            Exit Sub
        Else
            FileDir = .SelectedItems(1) & "\"
        End If
    End With
FiletoList = Dir(FileDir & "")
    Do Until FiletoList = ""

Viewing all articles
Browse latest Browse all 90189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>