Thanks for looking at my post
Issue is, in the source folder have multiple sub folder's where excel file is located which is all in .XLS format. I wanted to transfer all .xls files from source folder (which will have multiple sub folder's ). Is there any generic code where it will search for all .xls file from source folder and transfer to destination just as all .xls files instead of folders?
Code: Select all
Sub Button1_Click() Dim xTFile As String Dim xExtArr As Variant Dim xExt As Variant Dim xSPath As String Dim xDPath As String Dim xSFile As String Dim xCount As Long xSPath = "C:\Users\Desktop\Move file\Source\" xDPath = "C:\Users\Desktop\Move file\Destination\" xExtArr = Array("*.xlsx*", "*.xlsm") For Each xExt In xExtArr xTFile = Dir(xSPath & xExt) Do While xTFile <> "" xSFile = xSPath & xTFile FileCopy xSFile, xDPath & xTFile Kill xSFile xTFile = Dir xCount = xCount + 1 Loop Next End Sub