Thread
:
macro ...if command, I suppose...
View Single Post
#
2
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
Don Guillett[_4_]
external usenet poster
Posts: 2,337
macro ...if command, I suppose...
Have a look at ON ERROR (easy way is to type on error in the vbe and hit f1
key)
on error goto mymsg
code
mymsg:
"blah blah"
--
Don Guillett
SalesAid Software
"Mario" wrote in message
...
Hi everybody
I recorded a macro wich finds the word "new date" and then copies the
corresponding rows in another sheet... (no problem as far as here).
I would like if it found no occurrence it ended e gave a message as "no
occurrence found" instead of indicating a run time error.
I think it need an if command, I tried but without success...
I send the mail
Cells.Find(What:="new date", After:=ActiveCell,
LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Activate.
ActiveCell.Offset(0, -1).Range("A1").Select
Range(Selection, Selection.End(xlToLeft)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("ScadenzeClienti").Select
Application.Goto Reference:="R1C1"
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:=
_
False, Transpose:=False
End Sub
Thanks Mario
Reply With Quote
Don Guillett[_4_]
View Public Profile
Find all posts by Don Guillett[_4_]