Skip to content

Instantly share code, notes, and snippets.

@ndthanh
Created February 6, 2017 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ndthanh/219feabf26b4a3c6f7e73e6a61510447 to your computer and use it in GitHub Desktop.
Save ndthanh/219feabf26b4a3c6f7e73e6a61510447 to your computer and use it in GitHub Desktop.
Sub MergeSheets()
Dim x As Integer
Dim ws As Worksheet
On Error GoTo ErrHandler
Application.ScreenUpdating = False
x = 1
For Each ws In ThisWorkbook.Sheets
If ws.Name <> "Tong Hop" Then
If x = 1 Then
ws.UsedRange.Copy Sheets("Tong Hop").Range("A1")
Else
lr = Sheets("Tong Hop").UsedRange.Rows.Count
ws.UsedRange.Offset(1).Copy Sheets("Tong Hop").Range("A" & lr + 1)
End If
x = x + 1
End If
Next ws
ErrHandler:
Debug.Print Err.Description
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment