PDA

View Full Version : Test 3 spots



Djblois
11-09-2009, 11:49 AM
I am using this code to test if a Product Code is Numeric:

With Range("A9")
If stgReportType = "PS" Then
vCode = Split(Split(.Value, "(")(1), ")")(0)
If IsNumeric(vCode) Then


However, sometimes it will be alphabetical (rare but it may happen). So now I want to test in three places places which I know how to do, but how will I say it needs to be true at least 2 times. So if it is true one of the places I test it will be false but if it is true 2 or 3 of the places then it will be true.

p45cal
11-10-2009, 05:38 AM
pseudo-code:
x = 0

If firstTest = True Then x = x + 1
If secondTest = True Then x = x + 1
If thirdTest = True Then x = x + 1

If x > 1 Then MsgBox "It's OK!" Else MsgBox "Failed"