Hi - I created the following code to find the word "result" on a worksheet and if found, delete the row. The code below works but displays an error after it runs:
Object Variable or With block variable not set
The error relates to the code highlighted in blue below:
Sub FindResult()
Dim i As Integer
For i = 1 To 10
Cells.find(What:="Result", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.EntireRow.Select
Selection.Delete Shift:=xlUp
Next i
Range("A1").Activate
End Sub
----------
I am not sure what I need to include to tweak the code. Any help would be appreciated. Thank you! - J
Object Variable or With block variable not set
The error relates to the code highlighted in blue below:
Sub FindResult()
Dim i As Integer
For i = 1 To 10
Cells.find(What:="Result", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.EntireRow.Select
Selection.Delete Shift:=xlUp
Next i
Range("A1").Activate
End Sub
----------
I am not sure what I need to include to tweak the code. Any help would be appreciated. Thank you! - J