Skip to content

Instantly share code, notes, and snippets.

@imamuddinwp
Created October 20, 2020 11:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imamuddinwp/d461f7ea35f41039561614d81a5dc543 to your computer and use it in GitHub Desktop.
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" "…
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
@imamuddinwp
Copy link
Author

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment