+ Reply to Thread
Results 1 to 3 of 3

Error trapping

  1. #1
    craigoutinoz@hotmail.com
    Guest

    Error trapping

    Hi,

    I have the below coding, it all works however I need to be able to put
    a variable figure on the range B17. i.e. some cards have 16 digits,
    some have 19. So I need to instruct the sheet to return a message when
    there less or more numbers than this??

    Can anyone help?

    Thanks in advance.

    Cragcito



    Public Sub Pre_Checks_Before_Mail()

    If Range("B13").Value = "" Then
    MsgBox "You have not entered The Account Number."
    Exit Sub
    End If


    If Range("B14").Value = "" Then
    MsgBox "You have not entered The Customer Number."
    Exit Sub
    End If

    If Range("B16").Value = "" Then
    MsgBox "You have not entered Card Security Number."
    Exit Sub
    End If

    If Range("B17").Value = "" Then
    MsgBox "Please enter Exact Name on Card."
    Exit Sub
    End If

    ''If Range("B17").Value <= "****************" Then
    '' MsgBox "Card Number must be at least 16 digits."
    '' Exit Sub
    ''End If

    If Range("B19").Value >= Range("E15").Value Then
    MsgBox "Card is to NEW"
    Exit Sub
    End If

    If Range("B20").Value = 0 Then
    MsgBox "Expiry date is needed"
    Exit Sub
    End If

    If Range("B20").Value <= Range("E15").Value Then
    MsgBox "Card has EXPIRED"
    Exit Sub
    End If

    If Range("B18").Value < 0 Then
    MsgBox "We can process a card payment without a card
    number?!?!?!?!."
    Exit Sub
    End If

    If Range("B22").Value = 0 Then
    MsgBox "We MUST have a phone number to contact customer"
    Exit Sub
    End If

    If Range("B23").Value = "" Then
    MsgBox "Card BILLING address is required"
    Exit Sub
    End If

    If Range("B8").Value > 0 Then
    MsgBox "Is customer aware of 2% surcharge??"
    Exit Sub
    End If

    '' If Range("B17").Value <= "???????????????" Then
    '' MsgBox "Card Number must be at least 16 digits."
    '' Exit Sub
    ''End If


  2. #2
    Nick Hodge
    Guest

    Re: Error trapping

    Craig

    Sub test()
    If Len(Range("A1").Value) < 16 Then
    MsgBox "Must be more than 16 chars"
    End If
    End Sub

    --
    HTH
    Nick Hodge
    Microsoft MVP - Excel
    Southampton, England
    www.nickhodge.co.uk
    nick_hodgeTAKETHISOUT@zen.co.uk.ANDTHIS


    <craigoutinoz@hotmail.com> wrote in message
    news:1151841903.553603.199770@h44g2000cwa.googlegroups.com...
    > Hi,
    >
    > I have the below coding, it all works however I need to be able to put
    > a variable figure on the range B17. i.e. some cards have 16 digits,
    > some have 19. So I need to instruct the sheet to return a message when
    > there less or more numbers than this??
    >
    > Can anyone help?
    >
    > Thanks in advance.
    >
    > Cragcito
    >
    >
    >
    > Public Sub Pre_Checks_Before_Mail()
    >
    > If Range("B13").Value = "" Then
    > MsgBox "You have not entered The Account Number."
    > Exit Sub
    > End If
    >
    >
    > If Range("B14").Value = "" Then
    > MsgBox "You have not entered The Customer Number."
    > Exit Sub
    > End If
    >
    > If Range("B16").Value = "" Then
    > MsgBox "You have not entered Card Security Number."
    > Exit Sub
    > End If
    >
    > If Range("B17").Value = "" Then
    > MsgBox "Please enter Exact Name on Card."
    > Exit Sub
    > End If
    >
    > ''If Range("B17").Value <= "****************" Then
    > '' MsgBox "Card Number must be at least 16 digits."
    > '' Exit Sub
    > ''End If
    >
    > If Range("B19").Value >= Range("E15").Value Then
    > MsgBox "Card is to NEW"
    > Exit Sub
    > End If
    >
    > If Range("B20").Value = 0 Then
    > MsgBox "Expiry date is needed"
    > Exit Sub
    > End If
    >
    > If Range("B20").Value <= Range("E15").Value Then
    > MsgBox "Card has EXPIRED"
    > Exit Sub
    > End If
    >
    > If Range("B18").Value < 0 Then
    > MsgBox "We can process a card payment without a card
    > number?!?!?!?!."
    > Exit Sub
    > End If
    >
    > If Range("B22").Value = 0 Then
    > MsgBox "We MUST have a phone number to contact customer"
    > Exit Sub
    > End If
    >
    > If Range("B23").Value = "" Then
    > MsgBox "Card BILLING address is required"
    > Exit Sub
    > End If
    >
    > If Range("B8").Value > 0 Then
    > MsgBox "Is customer aware of 2% surcharge??"
    > Exit Sub
    > End If
    >
    > '' If Range("B17").Value <= "???????????????" Then
    > '' MsgBox "Card Number must be at least 16 digits."
    > '' Exit Sub
    > ''End If
    >




  3. #3
    Andrew Taylor
    Guest

    Re: Error trapping

    If Len(Range("B17").Value) < 16 Then
    MsgBox "Card Number must be at least 16 digits."
    ... etc

    Andrew

    craigoutinoz@hotmail.com wrote:
    > Hi,
    >
    > I have the below coding, it all works however I need to be able to put
    > a variable figure on the range B17. i.e. some cards have 16 digits,
    > some have 19. So I need to instruct the sheet to return a message when
    > there less or more numbers than this??
    >
    > Can anyone help?
    >
    > Thanks in advance.
    >
    > Cragcito
    >
    >
    >
    > Public Sub Pre_Checks_Before_Mail()
    >
    > If Range("B13").Value = "" Then
    > MsgBox "You have not entered The Account Number."
    > Exit Sub
    > End If
    >
    >
    > If Range("B14").Value = "" Then
    > MsgBox "You have not entered The Customer Number."
    > Exit Sub
    > End If
    >
    > If Range("B16").Value = "" Then
    > MsgBox "You have not entered Card Security Number."
    > Exit Sub
    > End If
    >
    > If Range("B17").Value = "" Then
    > MsgBox "Please enter Exact Name on Card."
    > Exit Sub
    > End If
    >
    > ''If Range("B17").Value <= "****************" Then
    > '' MsgBox "Card Number must be at least 16 digits."
    > '' Exit Sub
    > ''End If
    >
    > If Range("B19").Value >= Range("E15").Value Then
    > MsgBox "Card is to NEW"
    > Exit Sub
    > End If
    >
    > If Range("B20").Value = 0 Then
    > MsgBox "Expiry date is needed"
    > Exit Sub
    > End If
    >
    > If Range("B20").Value <= Range("E15").Value Then
    > MsgBox "Card has EXPIRED"
    > Exit Sub
    > End If
    >
    > If Range("B18").Value < 0 Then
    > MsgBox "We can process a card payment without a card
    > number?!?!?!?!."
    > Exit Sub
    > End If
    >
    > If Range("B22").Value = 0 Then
    > MsgBox "We MUST have a phone number to contact customer"
    > Exit Sub
    > End If
    >
    > If Range("B23").Value = "" Then
    > MsgBox "Card BILLING address is required"
    > Exit Sub
    > End If
    >
    > If Range("B8").Value > 0 Then
    > MsgBox "Is customer aware of 2% surcharge??"
    > Exit Sub
    > End If
    >
    > '' If Range("B17").Value <= "???????????????" Then
    > '' MsgBox "Card Number must be at least 16 digits."
    > '' Exit Sub
    > ''End If



+ 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