• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

I want to copy Columns A,D,G, F from multiple workbooks and save it as different sheets of a single

beginner

New Member
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:
Back
Top