soldier2gud4me
New Member
- Joined
- Dec 29, 2021
- Messages
- 6
- Office Version
- 365
- Platform
- Windows
Hi there,
Im looking for a way to delete a total of 6 rows if a cell (C20) in the first of those 6 rows contains "#REF!". Here's what i have so far :
Sub Button7_Click()
Dim srchRng As Range
Worksheets("Summary").Activate
ActiveWindow.DisplayFormulas = False
Set srchRng = Range("C20:C300")
Dim c As Range
For Each c In srchRng
If c.Formula = "=#REF!" Then
ActiveWorkbook.Worksheets("Aug").Columns(2).SpecialCells(xlFormulas, xlErrors).EntireRow.Delete
Exit For
End If
Next
End Sub
Im looking for a way to delete a total of 6 rows if a cell (C20) in the first of those 6 rows contains "#REF!". Here's what i have so far :
Sub Button7_Click()
Dim srchRng As Range
Worksheets("Summary").Activate
ActiveWindow.DisplayFormulas = False
Set srchRng = Range("C20:C300")
Dim c As Range
For Each c In srchRng
If c.Formula = "=#REF!" Then
ActiveWorkbook.Worksheets("Aug").Columns(2).SpecialCells(xlFormulas, xlErrors).EntireRow.Delete
Exit For
End If
Next
End Sub