Last active
June 6, 2019 03:06
-
-
Save DuongAQ/0a504473b0deb356ccfd0819851afc1f 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 GopSheet_XoaTrung() | |
Dim x As Integer | |
Dim lr as long | |
Dim ws As Worksheet | |
On Error GoTo ErrHandler | |
Application.ScreenUpdating = False | |
'Gộp sheet | |
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 | |
'Xóa trùng | |
lr = Sheets("Tong Hop").UsedRange.Rows.Count | |
Sheets("Tong hop").Range("A1:C" & lr).RemoveDuplicates Columns:=Array(1, 2, 3), Header:=xlYes | |
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