mình tìm kiếm được 1 code VBA xóa dòng trống. nhưng trong bảng của mình có những dòng có công thức nên mình muốn sửa lại thành xóa dòng khi kết quả là 0 hoặc là dấu "-". mình sửa mãi không được, các bạn giúp mình sửa với.
Sub XoaDongTrong()
Dim i As Long
Dim j As Long
Dim d As Long
Dim dongdau As Long
Dim socot As Long
Dim dem As Long
d = ActiveSheet.Range("D" & ActiveSheet.Rows.Count).End(xlUp).Row
socot = 10
dem = 0
If socot > 0 Then
dongdau = InputBox("Nhap so dong dau tien bang du lieu: ")
If dongdau > 0 Then
For i = dongdau To d
For j = 1 To socot
If ActiveSheet.Cells(i, j) = "" Then
dem = dem + 1
If dem = socot Then
Rows(i).Delete
End If
End If
Next j
dem = 0
Next i
End If
End If
End Sub
Sub XoaDongTrong()
Dim i As Long
Dim j As Long
Dim d As Long
Dim dongdau As Long
Dim socot As Long
Dim dem As Long
d = ActiveSheet.Range("D" & ActiveSheet.Rows.Count).End(xlUp).Row
socot = 10
dem = 0
If socot > 0 Then
dongdau = InputBox("Nhap so dong dau tien bang du lieu: ")
If dongdau > 0 Then
For i = dongdau To d
For j = 1 To socot
If ActiveSheet.Cells(i, j) = "" Then
dem = dem + 1
If dem = socot Then
Rows(i).Delete
End If
End If
Next j
dem = 0
Next i
End If
End If
End Sub