Pamella
08-02-2019, 02:56 AM
Trying to find a word and if not found then exit sub
Not sure if I can do it like this?
Sub DeleteRows()
Const WordToLook = "TESTING"
Dim RowWord As Long
Dim foundcell As Range
Set foundcell = (RowWord = Columns(1).Find(WordToLook, LookAt:=xlPart).Row)
If foundcell Is Nothing Then
Exit Sub
Else
Rows(RowWord + 5 & ":" & RowWord).Delete
end if
exit sub
Not sure if I can do it like this?
Sub DeleteRows()
Const WordToLook = "TESTING"
Dim RowWord As Long
Dim foundcell As Range
Set foundcell = (RowWord = Columns(1).Find(WordToLook, LookAt:=xlPart).Row)
If foundcell Is Nothing Then
Exit Sub
Else
Rows(RowWord + 5 & ":" & RowWord).Delete
end if
exit sub