PDA

View Full Version : Solved: Step on through the code



Gil
12-05-2011, 09:31 PM
Hello

I use the following code sucessfully but on the odd occasion when the item is not found the code stops. Is there an easy add on to make it step on through the code. A message in E3 might be nice but not essential If there is I havn't been able to work it out. Any help would be appreciated.

Many thanks for all your continued support
Gil

Only part is shown


Dim c As Range


Set c = Range("H1:H1000").Find(What:="1/", LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False)


c.Copy Range("E3")

mancubus
12-06-2011, 12:39 AM
hi.
try..


If Not c Is Nothing Then
c.Copy Range("E3")
End If

mancubus
12-06-2011, 12:41 AM
to display a message when not found:

If Not c Is Nothing Then
c.Copy Range("E3")
Else
MsgBox "Not found!"
End If

Gil
12-06-2011, 01:21 AM
mancubus
The first part was great and will resolve my problem. The message box is good but I was looking for something entered into the cell "E3". Hope I am not sticking my head out too far for the goodwill.
Many thanks
Gil

Bob Phillips
12-06-2011, 02:03 AM
Prhaps you mean




If Not c Is Nothing Then
c.Copy Range("E3")
Else
Range("E3").Value = "Not found!"
End If

Gil
12-06-2011, 10:17 AM
Hello xld
That hit the spot exactly, all tried and tested, Many thanks for all your help.
Gil