Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi, I'm a VB newbie, and I'm learning as I go. I've got a macro that searches one spreadsheet for an account number then cuts the whole row that the account number appears on, and insert the row into a different spreadsheet. It works fine, unless the accoun number is not found. If that happens, it returns the Run-time erro '91' message. All I want it to do if it can't find the account number is to jump to the end of the procedure, but I can't work out th syntax. Here's the code : __________________________________________________ ____________ Sub test Windows("book1.xls").Activate Range("a1").Select On Error GoTo ERR_1 Cells.Find(What:="123456", After:=ActiveCell LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows SearchDirection:=xlNext, _ MatchCase:=False).Activate Rows(ActiveCell.Row).Select Application.CutCopyMode = False Selection.Cut Windows("book2.xls").Activate Rows("3:3").Select Selection.Insert Shift:=xlDown Windows("book1.xls").Activate Rows(ActiveCell.Row).Delete ERR_1: End Sub __________________________________________________ __________ I'm sure this is just me being stupid, but I've spent ages trying t figure it out and I just don't know where I've gone wrong. Any helpful comments will be gratefully received. Many thanks, Jo -- jonraywort ----------------------------------------------------------------------- jonrayworth's Profile: http://www.excelforum.com/member.php...fo&userid=3596 View this thread: http://www.excelforum.com/showthread.php?threadid=55751 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
correct syntax for nesting "if", "and", and "vlookup"....if possib | Excel Worksheet Functions | |||
Question on "On Error GoTo skip" | Excel Discussion (Misc queries) | |||
Can I place "On Error GOTO xxx" into module level? | Excel Programming | |||
Newbie Q: What does "On error goto 0" mean? | Excel Programming |