How to Delete Blank Rows in Excel | Fast & Easy!

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ธ.ค. 2024

ความคิดเห็น • 1

  • @ExcelUnder5Minutes
    @ExcelUnder5Minutes  3 หลายเดือนก่อน

    Macro - Follow instructions in Video. Thank you!
    Sub DeleteEmptyRows()
    Dim ws As Worksheet
    Dim lastRow As Long
    Dim i As Long
    ' Set the worksheet
    Set ws = ActiveSheet
    ' Find the last row with data in the worksheet
    lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
    ' Loop from the last row to the first row
    For i = lastRow To 1 Step -1
    ' Check if the row is completely empty
    If Application.WorksheetFunction.CountA(ws.Rows(i)) = 0 Then
    ws.Rows(i).Delete
    End If
    Next i
    End Sub