Created
October 20, 2020 11:19
-
-
Save imamuddinwp/d461f7ea35f41039561614d81a5dc543 to your computer and use it in GitHub Desktop.
Merge multiple worksheets into one; Combine multiple worksheets into one; "Keyword" "merge multiple sheets into one sheet vba" "merge multiple excel sheets into one workbook online free" "consolidate data from multiple worksheets in a single worksheet" "combine multiple excel sheets into one macro" "copy data from multiple worksheets into one" "…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub Merge_All_In_One() | |
' | |
' | |
' | |
' https://about.me/imamuddinwp/ | |
' | |
' | |
' | |
Dim fnameList, fnameCurFile As Variant | |
Dim countFiles, countSheets As Integer | |
Dim wksCurSheet As Worksheet | |
Dim wbkCurBook, wbkSrcBook As Workbook | |
fnameList = Application.GetOpenFilename(FileFilter:="Microsoft Excel Workbooks (*.xls;*.xlsx;*.xlsm),*.xls;*.xlsx;*.xlsm", Title:="Welcome! :) Choose Excel files to merge from your directory", MultiSelect:=True) | |
If (vbBoolean <> VarType(fnameList)) Then | |
If (UBound(fnameList) > 0) Then | |
countFiles = 0 | |
countSheets = 0 | |
Application.ScreenUpdating = False | |
Application.Calculation = xlCalculationManual | |
Set wbkCurBook = ActiveWorkbook | |
For Each fnameCurFile In fnameList | |
countFiles = countFiles + 1 | |
Set wbkSrcBook = Workbooks.Open(fileName:=fnameCurFile) | |
For Each wksCurSheet In wbkSrcBook.Sheets | |
countSheets = countSheets + 1 | |
wksCurSheet.Copy after:=wbkCurBook.Sheets(wbkCurBook.Sheets.Count) | |
Next | |
wbkSrcBook.Close SaveChanges:=False | |
Next | |
Application.ScreenUpdating = True | |
Application.Calculation = xlCalculationAutomatic | |
MsgBox "Congrats! " & countSheets & " Workbook(s) merged successfully!!! " & vbCrLf & " From " & countFiles & " Excel File(s) :) !!!" & "https://about.me/imamuddinwp/", Title:="ProudLy powered by ImAmUdDiN" | |
End If | |
Else | |
MsgBox "Sorry! No files was selected", Title:="ProudLy powered by ImAmUdDiN" | |
End If | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Merge multiple worksheets into one;
Combine multiple worksheets into one;
Keywords:
merge multiple sheets into one sheet vba;
"merge multiple excel sheets into one workbook online free" "consolidate data from multiple worksheets in a single worksheet" "combine multiple excel sheets into one macro" "copy data from multiple worksheets into one" "how to combine multiple workbooks to one workbook in excel" "how to consolidate data in excel from multiple worksheets" "consolidate data from multiple worksheets in a single worksheet vba"