Open multiple workbook then combine into single workbook but different sheets
Use a macro - run the code below, and select the files of interest in the dialog.
HTH,
Bernie
MS Excel MVP
Sub MergeUserSelectedFiles()
Dim FileArray As Variant
Dim myB As Workbook
Dim i As Integer
FileArray = Application.GetOpenFilename(MultiSelect:=True)
If IsArray(FileArray) Then
For i = LBound(FileArray) To UBound(FileArray)
Set myB = Workbooks.Open(FileArray(i))
myB.Worksheets.Copy befo=ThisWorkbook.Worksheets(1)
myB.Close False
Next i
Else:
MsgBox "You clicked cancel"
End If
End Sub
"geniusideas" wrote in message
...
Hi!
The task now is to Open multiple workbook then combine into single
workbook but different sheets.
Pls help how to do in vba?
Thanks
|