Runtime error 91
I want to search a special character in my selected range of Excel sheet and
replace it with "A". I am using code mentioned below.
Public Sub test()
Dim firstaddress As String
Range("A418", "I441").Select
Set temp = Selection.Find(what:="$", After:=ActiveCell,
LookIn:=xlFormulas, LookAt:=xlPart)
If Not temp Is Nothing Then
firstaddress = temp.Address
Do
Range(temp.Address).FormulaR1C1 = "A"
Set temp = Selection.FindNext(temp)
Loop While Not temp Is Nothing And temp.Address < firstaddress
End If
End Sub
It works fine till it find the requested characters. Once it didnot find
anything it returns an Runtime error 91! Any solution for this?
Thanks in advane.
|