Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: Simple Problem

  1. #1
    New Member
    Join Date
    Mar 2002
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Im using this code :

    If Range("B8") < 18 And _
    Range("B17") > 0 Then
    MsgBox "Error"
    End If
    End Sub

    but sometimes B8 is #N/A and therefore i get the 'run time error 13'. Anyway i can make this stop happening?

    cheers

    [ This Message was edited by: Coded on 2002-04-21 04:12 ]

  2. #2
    BatCoder
    Join Date
    Feb 2002
    Location
    Turkey
    Posts
    813
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default

    May be you want a simple Error Handler:


    On Error GoTo ErrHandler
    If Range("B8") < 18 And _
    Range("B17") > 0 Then
    MsgBox "Error"
    End If
    ErrHandler:

  3. #3
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    What do you want your code to do if #N/A is present?
    Tom

  4. #4
    New Member
    Join Date
    Mar 2002
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    If it is #N/A i want nothing to happen, as in no msg box appearing

  5. #5
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Then use Smozgur's code or use
    On Error Resume Next
    Tom

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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