Created
February 1, 2020 09:34
-
-
Save compustar/14508196a1486b2548d41e55e54af8c6 to your computer and use it in GitHub Desktop.
VBA to merge Excel Worksheets
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 Macro3() | |
' | |
' Macro3 Macro | |
' | |
newSheetName = "MergedSheet" | |
On Error Resume Next | |
Sheets(newSheetName).Select | |
If ActiveSheet.Name <> newSheetName Then | |
Sheets.Add | |
ActiveSheet.Name = newSheetName | |
End If | |
For Each x In Sheets | |
If x.Name <> newSheetName Then | |
x.Select | |
Range("A1").CurrentRegion.Select | |
Selection.Copy | |
Range("A1").Select | |
Sheets(newSheetName).Select | |
ActiveSheet.Paste | |
Cells(Cells(1, 2).End(xlDown).Row + 1, 1).Select | |
End If | |
Next | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment