[FONT="]Hi,<o></o>[/FONT]
[FONT="]<o> </o>[/FONT]
[FONT="]This is driving me mad….. please see below code works when it finds Sales but if there are no sales then I get a Run-time error 91 Object variable or with block variable not set can anyone point me in the right direction please?[/FONT]
Thanks
[FONT="]<o></o>[/FONT]
[FONT="]<o> </o>[/FONT]
[FONT="]This is driving me mad….. please see below code works when it finds Sales but if there are no sales then I get a Run-time error 91 Object variable or with block variable not set can anyone point me in the right direction please?[/FONT]
Code:
Sub test()
Dim r, f As Range
Set r = Range("A1:A50")
Set f = r.Find(What:="Sales", LookIn:=xlValues, LookAt:=xlPart)
If f = "Sales" Then
MsgBox ("Found Sales")
If f Is Nothing Then
MsgBox ("No Sales")
End If
End If
End Sub
[FONT="]<o></o>[/FONT]