Error trapping

C

craigoutinoz

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
 
N

Nick Hodge

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
(e-mail address removed)
 
A

Andrew Taylor

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

Andrew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top