Skip to content

Instantly share code, notes, and snippets.

@DuongAQ
Created February 7, 2018 07:18
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 DuongAQ/2a4a7c22a271094e8fabb95ddae9939a to your computer and use it in GitHub Desktop.
Save DuongAQ/2a4a7c22a271094e8fabb95ddae9939a to your computer and use it in GitHub Desktop.
Sub BCCT_Update()
Application.ScreenUpdating = False
'Xoa noi dung cu cua bao cao
Range("H6:K100").ClearContents
'Lenh cap nhat du lieu tu dong
'Tao bo loc tu dong
Range("A2:F2").AutoFilter
'Loc theo cac dieu kien cua bao cao
ActiveSheet.Range("$A$2:$F$47").AutoFilter Field:=2, Criteria1:=Sheet1.Cells(4, 9).Value
ActiveSheet.Range("$A$2:$F$47").AutoFilter Field:=1, _
Criteria1:=">=" & CLng(Sheet1.Cells(2, 9).Value), _
Operator:=xlAnd, _
Criteria2:="<=" & CLng(Sheet1.Cells(3, 9).Value)
'Copy noi dung ket qua bao cao
ActiveSheet.Range("$C$3:$F$47").SpecialCells(xlVisible).Copy
'Luu noi dung vao bao cao chi tiet
Range("H6").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
'Bo che do Copy
Application.CutCopyMode = False
'Bo bo loc tu dong
Range("A2:F2").AutoFilter
Application.ScreenUpdating = True
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment