Untitled

 avatar
unknown
plain_text
21 days ago
495 B
2
Indexable
Private Sub RemoveBlankCountryRows(wsReport As Worksheet, startCol As Long, endCol As Long)
    Dim lastRow As Long, i As Long
    lastRow = wsReport.Cells(wsReport.Rows.Count, 1).End(xlUp).Row
    
    ' Loop from the bottom to the top to avoid shifting rows during deletion
    For i = lastRow To 4 Step -1
        If WorksheetFunction.CountA(wsReport.Range(wsReport.Cells(i, startCol), wsReport.Cells(i, endCol))) = 0 Then
            wsReport.Rows(i).Delete
        End If
    Next i
End Sub
Leave a Comment