Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.