Delete Entire Row If No Data Is Found

less than 1 minute read

These piece of code lets you delete an entire row within the used range of the sheet if the entire row contains no data.

' ======================================================================================================
' ## Deletes the entire row within the used range
' if the ENTIRE row contains no data
Sub DeleteBlankRows() ' Vars Dim rngUsedRange As Range Dim lngRow As Long ' Get the used range on sheet to prepare deleting rows Set rngUsedRange = ActiveSheet.UsedRange ' Delete entire rows that contain no data For lngRow = rngUsedRange.Rows.Count To 1 Step -1 If WorksheetFunction.CountA(rngUsedRange.Rows(lngRow)) = 0 Then rngUsedRange.Rows(lngRow).EntireRow.Delete End If Next lngRow
End Sub

Tags: deleting-data

Categories: vba

Updated: November 16, 2018

Twitter Facebook LinkedIn

1 minute read

Here’s the simple steps to highlight the row and column of the selected cell which can be extremely useful when navigating large sets of data. Here’s a littl…

less than 1 minute read

How it Works Using SEARCH and ISNUMBER When you need to check if a cell contains specific text (or string) we need to combing the SEARCH and ISNUMBER functio…

less than 1 minute read

So you have a 0% value on one of your data labels and want to hide it?

1 minute read

Download the example workbook here: calculate-time-between-dates.xlsx

Leave a Comment