• 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.

Select a folder, loop all workbooks & move a particular sheet

Mr.Karr

Member
Hello

Can anyone please provide VBA code snippet for below;

In brief: I have an activity where I have workbooks saved in a folder. Macro has to loop through all workbook and move a particular worksheet named "Data" from that folder.

Any help would be greatly appreciated.

Thanks,
Karthik
 
@Luke M : those sheets to the source workbook.
sorry, I did had a look with the link you've provided but the page you've recommended doesn't have a solution to this.
Please advise
 
@Luke M : I have managed to utilize available content and require your help to modify that a bit.

Can you pls modify the below code to only copy sheet named "Data" from available workbooks please ? Thanks!
Code:
 If Not mybook Is Nothing Then
            For Each sh In mybook.Worksheets
                sh.Copy after:=ThisWorkbook.Worksheets(ThisWorkbook.Worksheets.Count)
            Next sh
 
Change that block of code to:
Code:
 If Not mybook Is Nothing Then
        Set sh = mybook.Worksheets("Data")
        sh.Copy after:=ThisWorkbook.Worksheets(ThisWorkbook.Worksheets.Count)
 
Back
Top