Many a times we comeacross a situation where we want to process all the excel sheets or some of the excel files in a folder and it becomes a tedious job to get it done taking hours and days sometimes. I cameacross the following code form vbaexpress.com where this code will take care of all the excel files in a folder. I hope this helps. I am thankful to “Ken Puls”, as I have learned many things from yhis posts and tips. — Selva V Pasupathy
Option Explicit
Sub GetAllFiles_In_a_Folder(sPath As String)
Dim Wb As Workbook, sFile As String
sFile = Dir(sPath & "\" & "*.xls")
'Loop through all .xls-Files in that path
Do While sFile ""
Set Wb = Workbooks.Open(sPath & "\" & sFile)
'Do something with that Workbook, insert whatever you want to do here
Debug.Print Wb.Name
'You can save it, if you like, here it's not saved
Wb.Close False
sFile = Dir
Loop
End Sub