+ Reply to Thread
Results 1 to 3 of 3

Program vb to do something in case of an error.

  1. #1
    Registered User
    Join Date
    06-13-2005
    Posts
    5

    Program vb to do something in case of an error.

    I have read the tips and googled this problem but I cannot find the answer to it, so I am looking for your help.

    My workbook is programed to copy the contents of one cell and find that excat match in another workbook. The problem comes up when the macro cannot find that match in the other workbook so my macro halts stating error. How can I program my macro to ignore the error of not finding that item and move on to the next cell.
    Thanks to anyone who can help me.

    Benjamin Woodruff

  2. #2
    Tim Williams
    Guest

    Re: Program vb to do something in case of an error.

    show the code - what line does it error on?

    tim

    "bjwoodruff" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > I have read the tips and googled this problem but I cannot find the
    > answer to it, so I am looking for your help.
    >
    > My workbook is programed to copy the contents of one cell and find
    > that
    > excat match in another workbook. The problem comes up when the macro
    > cannot find that match in the other workbook so my macro halts
    > stating
    > error. How can I program my macro to ignore the error of not finding
    > that item and move on to the next cell.
    > Thanks to anyone who can help me.
    >
    > Benjamin Woodruff
    >
    >
    > --
    > bjwoodruff
    > ------------------------------------------------------------------------
    > bjwoodruff's Profile:
    > http://www.excelforum.com/member.php...o&userid=24259
    > View this thread:
    > http://www.excelforum.com/showthread...hreadid=384427
    >




  3. #3
    Rowan
    Guest

    RE: Program vb to do something in case of an error.

    One way is to set the found cell to a range variable. You can then test the
    range variable to see if the contents of your original cell were found.

    Something like this:

    Dim FindIt As Range
    'find lookup value
    'switch to other sheet or set a range to test
    With Cells ' check all cells or change to set range
    Set FindIt = .Find("6995", LookIn:=xlValues)
    End With
    If Not FindIt Is Nothing Then
    'Do whatever you lke with FindIt
    End If

    Hope this helps
    Rowan

    "bjwoodruff" wrote:

    >
    > I have read the tips and googled this problem but I cannot find the
    > answer to it, so I am looking for your help.
    >
    > My workbook is programed to copy the contents of one cell and find that
    > excat match in another workbook. The problem comes up when the macro
    > cannot find that match in the other workbook so my macro halts stating
    > error. How can I program my macro to ignore the error of not finding
    > that item and move on to the next cell.
    > Thanks to anyone who can help me.
    >
    > Benjamin Woodruff
    >
    >
    > --
    > bjwoodruff
    > ------------------------------------------------------------------------
    > bjwoodruff's Profile: http://www.excelforum.com/member.php...o&userid=24259
    > View this thread: http://www.excelforum.com/showthread...hreadid=384427
    >
    >


+ Reply to 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