Hi
I'm trying to automatically delete rows in excel which meet certain criteria.
I have a spreadsheet with 13 columns and column F is an indicator which contains either "mortgage" or blank.
I have created the following code using Thread 707-687994:-
Sub deletenonmort()
lRow = Cells(65536, 6).End(xlUp).Row
Range("A1:M" & lRow).AutoFilter Field:=6, Criteria1:=""
Rows("2:" & lRow).Delete Shift:=xlUp
Selection.AutoFilter Field:=6
End Sub
This works fine until it reaches the last row that contains "mortgage" and then doesn't delete any more blank rows after that.
I have next to no knowledge of VBA so any help would be much appreciated.
Thanks
I'm trying to automatically delete rows in excel which meet certain criteria.
I have a spreadsheet with 13 columns and column F is an indicator which contains either "mortgage" or blank.
I have created the following code using Thread 707-687994:-
Sub deletenonmort()
lRow = Cells(65536, 6).End(xlUp).Row
Range("A1:M" & lRow).AutoFilter Field:=6, Criteria1:=""
Rows("2:" & lRow).Delete Shift:=xlUp
Selection.AutoFilter Field:=6
End Sub
This works fine until it reaches the last row that contains "mortgage" and then doesn't delete any more blank rows after that.
I have next to no knowledge of VBA so any help would be much appreciated.
Thanks