Created
January 22, 2018 08:20
-
-
Save DuongAQ/c38c3f8f8fc4f0afa03077cbf6bf3c40 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 Loc_BCCT() | |
'Biện luận trường hợp không phát sinh | |
If Range("N1").Value = 0 Then | |
MsgBox "Khong co du lieu phat sinh" | |
Range("H6:K26").ClearContents | |
Exit Sub | |
Else | |
Application.ScreenUpdating = False | |
'Xóa dữ liệu cũ trong báo cáo | |
Range("H6:K26").ClearContents | |
'Mở chức năng lọc dữ liệu | |
Range("A2:F2").AutoFilter | |
'Lọc nội dung theo điều kiện | |
ActiveSheet.Range("$A$2:$F$47").AutoFilter Field:=2, Criteria1:=Range("I4").Value | |
ActiveSheet.Range("$A$2:$F$47").AutoFilter Field:=1, Criteria1:= _ | |
">=" & CLng(Range("I2").Value), Operator:=xlAnd, Criteria2:="<=" & CLng(Range("I3").Value) | |
'Chọn nội dung cần Copy >> Sử dụng SpecialCells | |
'Range("C3:F47").SpecialCells(xlCellTypeVisible).Copy | |
Range("C3:F47").SpecialCells(12).Copy 'xlCellTypeVisible = 12 | |
'Copy và Paste dữ liệu vào vị trí báo cáo | |
Range("H6").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ | |
:=False, Transpose:=False | |
'Bỏ chức năng lọc | |
ActiveSheet.Range("$A$2:$F$47").AutoFilter | |
Application.ScreenUpdating = True | |
End If | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment