Chỉ cách xóa row trắng xen kẽ liên tục

Liên hệ QC
Bạn tham khảo đoạn code này nhé

PHP:
Sub del_row()
 
With Application
       .DisplayAlerts = False
       .ScreenUpdating = False
End With
 
Dim rc As Long
rc = Cells(Cells.Rows.Count, 1).End(xlUp).Row
Do
  If Trim(Cells(rc, 1)) = "" Then
    Cells(rc, 1).EntireRow.Delete Shift:=xlUp
  End If
  rc = rc - 1
Loop While rc > 1
 
With Application
    .DisplayAlerts = True
    .ScreenUpdating = True
End With
[A1].Select
 
End Sub
Bạn ơi cho mình xin code này mà sửa dùm mình xóa cột B nhé! Cảm ơn ạ!
 
Cảm ơn bạn, mình muốn xóa cột B , bắt đầu từ B7 bạn ơi. Giúp mình nhé.
 
Cảm ơn bạn, mình muốn xóa cột B , bắt đầu từ B7 bạn ơi. Giúp mình nhé.

Bạn thêm điều kiện vô nữa
If rc <= 7 Then Exit Sub

Sub del_row()

With Application
.DisplayAlerts = False
.ScreenUpdating = False
End With

Dim rc As Long
rc = Cells(Cells.Rows.Count, 2).End(xlUp).Row
Do
If Trim(Cells(rc, 2)) = "" Then
Cells(rc, 2).EntireRow.Delete Shift:=xlUp
End If
rc = rc - 1
Loop While rc > 6 ' 1

With Application
.DisplayAlerts = True
.ScreenUpdating = True
End With
[A1].Select

End Sub
 
Lần chỉnh sửa cuối:
Web KT
Back
Top Bottom