I have written the below macros below, and it works perfect when there is data (example) 12345 on the SMT02 sheet.
So if 12345 is present, it leaves those rows and deletes the rest of the rows with other data.
But I want it to work in such a way, even if 12345 is not present, then I still want everything else (rows) to be deleted. At the moment it debugs and stops. Can anyone help please?
Dim c As Range
Dim SrchRng
Sheets("SMT02").Select
Range("B1").Select
Set SrchRng = ActiveSheet.Range("B1", ActiveSheet.Range("B65536").End(xlUp))
Do
Set c = SrchRng.Find("12345", LookIn:=xlValues)
If Not c Is Nothing Then c.EntireRow.Delete
Loop While Not c Is Nothing