Please see the below code..it will copy all the workbook in a folder to a single workbook with separate sheet but i need only some selected columns...plz help..!!
Code:
Sub getSheet()
Path = "E:\Test\"
Filename = Dir(Path & "*.xls")
If there are no Excel files in the folder, exit.
FilesInPath = Dir(MyPath & "*.xl*")
If FilesInPath = "" Then
MsgBox "No files found"
Exit Sub
End If
Do While Filename <> ""
Workbooks.Open Filename:=Path & Filename, ReadOnly:=True
For Each Sheet In ActiveWorkbook.Sheets
MsgBox Filename
' Sheet.Copy After:=ThisWorkbook.Sheets(1)
SourceRcount = sourceRange.Rows.Count
MsgBox SourceRcount
Next Sheet
Workbooks(Filename).Close
Filename = Dir()
Loop
ActiveWorkbook.Save
End Sub
Last edited by a moderator: