Closed Thread
Results 1 to 3 of 3

Overcoming Error when Find item not in excel range

  1. #1
    Registered User
    Join Date
    07-03-2008
    Location
    Adelaide
    Posts
    3

    Angry Overcoming Error when Find item not in excel range

    I am having trouble overcoming the error message arising from a find statement, when the item to be found is not present in the range being searched, and having the VBA macro continue with the search for other items in the find list, and was wondering if anyone has found a solution to this issue in excel 2003.
    ,
    I need the macro continue to find the next items in the list because they may appear in the search range at a later date.
    ,
    This is my loop where the error occurs;-
    Do Until PSDataEnd = "TOTAL"
    Workbooks("PAU Test Find" & ".xls").Activate
    Range(PAURange).Select
    On Error GoTo SupErrorProc
    If Selection.Find(What:=CoSuper).Select = True Then ‘Error occurs here
    On Error GoTo 0
    ActiveCell.Offset(0, -1).Select
    Selection.Copy
    End If
    Workbooks("Pay Sum Test " & PayNo & ".xls").Activate
    ActiveCell.Offset(0, 5).Select
    Selection.PasteSpecial Paste:=xlPasteValues
    ActiveCell.Offset(1, -5).Select
    PSDataEnd = (Mid(ActiveCell.Value, 3, 5))
    CoSuper = ActiveCell.Value
    Loop
    ActiveCell.Offset(-1, 0).Select
    PSRangeEnd = ActiveCell.Address
    ,
    This is my current error process;-
    SupErrorProc:
    On Error GoTo 0
    Workbooks("Pay Sum Test " & PayNo & ".xls").Activate
    ActiveCell.Offset(1, 0).Select
    CoSuper = ActiveCell.Value
    Workbooks("PAU Test Find" & ".xls").Activate
    Range(PAURange).Select
    If Selection.Find(What:=CoSuper).Select = True Then ‘Debug error occurs here
    Resume Next
    End If
    ,
    I have tried different things but always get a debug error at the find statement in the error process. Does anyone have a solution.
    Regards trex

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Overcoming Error when Find item not in excel range

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Overcoming Error when Find item not in excel range

    Your post does not comply with Rule 7 of our Forum RULES. Please do not ignore Moderators' or Administrators' requests - note that this includes requests by senior members as well, if you are unclear about their request or instruction then send a private message to them asking for help. Do not post a reply to a thread where a moderator has requested an action that has not been complied with e.g Title change or Code tags...etc

    Thread closed

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1