Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,173
Default 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
HIS


wrote in message
oups.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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 225
Default Error trapping

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

Andrew

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error Trapping from WSH Tom Chau Excel Discussion (Misc queries) 1 August 25th 06 04:21 AM
Error trapping hshayh0rn Excel Programming 1 May 4th 06 05:42 PM
Error Trapping JK Excel Programming 2 March 1st 06 11:45 PM
Error Trapping Neil Excel Programming 1 January 5th 04 04:38 PM
error trapping libby Excel Programming 5 November 25th 03 10:57 PM


All times are GMT +1. The time now is 03:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"