Hi everyone,

I am trying to workout a macro which will open a 2nd workbook, find each worksheet in the 2nd workbook with the same name as worksheets in the 1st workbook, and if there is a match copy the entire contents of the matching worksheet in workbook2 into the worksheet in workbook one. For example:

Workbook1 (contains the macro): this workbook as the following sheet names - 123, abc, 456, def
Workbook2: this workbook has the following sheets - 123, def

The macro will find the matching worksheet names and copy the content from the worksheets in Workbook2 into Workbook1.

Since there will be approx. 40 workbooks that the macro will need to search through in a folder, I'm recycling the following code I have from an old macro into this one. The copying code should fall within the DoEvents sections:

Dim wb As Workbook
Dim myPath As String
Dim myFile As String
Dim myExtension As String
Dim FldrPicker As FileDialog

  Application.ScreenUpdating = False
  Application.EnableEvents = False
  Application.Calculation = xlCalculationManual

  Set FldrPicker = Application.FileDialog(msoFileDialogFolderPicker)

    With FldrPicker
      .Title = "Select A Target Folder"
      .AllowMultiSelect = False
        If .Show <> -1 Then GoTo NextCode
        myPath = .SelectedItems(1) & "\"
    End With

NextCode:
  myPath = myPath
  If myPath = "" Then GoTo ResetSettings

  myExtension = "*.xl*"

  myFile = Dir(myPath & myExtension)

  Do While myFile <> ""
      Set wb = Workbooks.Open(Filename:=myPath & myFile)
        
      DoEvents
      
 
 
      wb.Close savechanges:=True
      
      DoEvents

      myFile = Dir
  Loop

  MsgBox "Task Complete!"

ResetSettings:
    Application.EnableEvents = True
    Application.Calculation = xlCalculationAutomatic
    Application.ScreenUpdating = True

End Sub
Any ideas?

Thanks!!