Untitled
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 ' Check only the specific columns for blank country values If Application.WorksheetFunction.CountA(wsReport.Range(wsReport.Cells(i, startCol), wsReport.Cells(i, endCol))) = 0 Then ' Delete the row if the range of country columns is empty wsReport.Rows(i).Delete End If Next i End Sub
Leave a Comment