Hello!
I'm working with a spreadsheet that has a summary tab - Sheets("Claim") - with 8 different tables on it. All the data on the tables has been pulled through from other tabs, each tab is for an individual project.
When a project is fully completed it's tab will be deleted from the workbook, which means that all the lines on the tables that came from it will be populated with #REF!
The tables are all within columns B through K
I'm hoping to put together a macro that can find all the rows that have #REF! errors and delete those rows.
The code I have currently is below, I'm stuck on the second half. Any assistance would be appreciated
Thank you
I'm working with a spreadsheet that has a summary tab - Sheets("Claim") - with 8 different tables on it. All the data on the tables has been pulled through from other tabs, each tab is for an individual project.
When a project is fully completed it's tab will be deleted from the workbook, which means that all the lines on the tables that came from it will be populated with #REF!
The tables are all within columns B through K
I'm hoping to put together a macro that can find all the rows that have #REF! errors and delete those rows.
The code I have currently is below, I'm stuck on the second half. Any assistance would be appreciated
Thank you
VBA Code:
Sub DeleteRefErrors()
'Clear filters for all tables
Dim lo As ListObject
'Loop through all Tables on the sheet
For Each lo In Sheets("Claim").ListObjects
'Clear All Filters for entire Table
lo.AutoFilter.ShowAllData
Next lo
'Find and delete rows containing #REF!
Dim a As Long
For a = Range("B" & Rows.Count).End(xlUp).Row To 2 Step -1
If Range("B" & a).Value = "#REF!" Then
Rows(a).EntireRow.Delete
End If
Next a
End Sub
Last edited by a moderator: