Created
February 6, 2017 15:28
-
-
Save ndthanh/219feabf26b4a3c6f7e73e6a61510447 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() | |
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