Thầy cho e hỏi, sao lệnh lọc nội dung lại báo lỗi 424 ạ
Sub Xoanoidung()
'chon o dang kick hoat, xoa dong do
Dim i As Long
i = ActiveCell.EntireRow.Row
'Xoa tu dong dau toi dong cuoi trong bang, dong duoc chon phai nam trong dong dau toi dong cuoi
'Chon dong dau
Dim dongdau As Long
dongdau = 4
'Chon dong cuoi
Dim dongcuoi As Long
dongcuoi = Sheet1.Range("G" & Rows.Count).End(xlUp).Row
If i < 4 Or i > dongcuoi Then
MsgBox "Khong duoc xoa ngoai pham vi"
Exit Sub
Else
Sheet1.Range("G" & i & ":I" & i).Clear.contents
' loc noi dung sau khi xoa
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add2 Key:=Range("I" & dongdau & ":I" & dongcuoi) _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("G" & dongdau & ":I" & dongcuoi)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End If
End Sub