trungvdb
Thành viên thường trực




- Tham gia
- 22/8/08
- Bài viết
- 374
- Được thích
- 171
- Nghề nghiệp
- Tài chính
PHP:
Private Function RemoveItem(SrcRng As Range, Criteria As Range) As Range
Dim tmpRng As Range
On Error GoTo ExitFunc
SrcRng.AdvancedFilter 1, Criteria
Set tmpRng = SrcRng.SpecialCells(12)
SrcRng.Parent.ShowAllData
tmpRng.EntireRow.Hidden = True
Set tmpRng = SrcRng.SpecialCells(12)
SrcRng.EntireRow.Hidden = False
Set RemoveItem = tmpRng
ExitFunc:
End Function
PHP:
Sub Main()
Dim Src1 As Range, Crit1 As Range, Src2 As Range, Crit2 As Range
Dim Del1 As Range, Del2 As Range
On Error GoTo ExitSub
Application.ScreenUpdating = False
Set Src1 = Range([A1], [A65536].End(xlUp))
Set Crit1 = Range("IU1:IU2")
Set Src2 = Range([B1], [B65536].End(xlUp))
Set Crit2 = Range("IV1:IV2")
Crit1(2) = "=COUNTIF(" & Src2.Address & ", " & Src1(2, 1).Address(0, 0) & ")=0"
Crit2(2) = "=COUNTIF(" & Src1.Address & ", " & Src2(2, 1).Address(0, 0) & ")=0"
Set Del1 = RemoveItem(Src1, Crit1)
Set Del2 = RemoveItem(Src2, Crit2)
Del1.Delete 2: Del2.Delete 2
ExitSub:
Crit1.ClearContents: Crit2.ClearContents
Application.ScreenUpdating = True
End Sub
Cho em được hỏi Delete 2 trong Code trên (Del1.Delete 2: Del2.Delete 2) có nghĩa là gì ah?