Skip to content

Instantly share code, notes, and snippets.

@quangpd
Created November 22, 2016 10:26
Show Gist options
  • Save quangpd/ac9ce5b16f40684e013ee706e1f93be3 to your computer and use it in GitHub Desktop.
Save quangpd/ac9ce5b16f40684e013ee706e1f93be3 to your computer and use it in GitHub Desktop.
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