Created
November 22, 2016 10:26
-
-
Save quangpd/ac9ce5b16f40684e013ee706e1f93be3 to your computer and use it in GitHub Desktop.
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 MergeSheets() | |
Const NHR = 1 | |
Dim MWS As Worksheet | |
Dim AWS As Worksheet | |
Dim FAR As Long | |
Dim LR As Long | |
Set AWS = ActiveSheet | |
For Each MWS In ActiveWindow.SelectedSheets | |
If Not MWS Is AWS Then | |
FAR = AWS.UsedRange.Cells(AWS.UsedRange.Cells.Count).Row + 1 | |
LR = MWS.UsedRange.Cells(MWS.UsedRange.Cells.Count).Row | |
MWS.Range(MWS.Rows(NHR + 1), MWS.Rows(LR)).Copy AWS.Rows(FAR) | |
End If | |
Next MWS | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment