I am writing a code for my job but I have hit a road block. I need to write a macro that checks sheet 1 for a specific number then if that number is not found then it searches three other sheets and if the number is found it deletes it. My problem is that I get an error (Run Time Error '91' Object Variable or block variable not set) when i run the program for a number that is not found on one of the subsequent sheets. Ive been working on this for days and I cant figure it out. Heres the code with the number replaced with stars
Sub Macro2()
'
' Macro2 Macro
'
'
Sheets("Master").Select
If Range("C1").Value = "*********" Then
Else
Sheets("ERT").Select
If Cells.Find(What:="***********", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate = True Then
ActiveCell.ClearContents
End If
Sheets("FT Phone").Select
If Cells.Find(What:="**********", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate = True Then
ActiveCell.ClearContents
End If
Sheets("Staff Does Not Report").Select
If Cells.Find(What:="**********", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate = True Then
ActiveCell.ClearContents
End If
End If
End Sub
Bookmarks