IF equal, but not equal to 100

How would I write this to say:  If ShipTabCol1 = ShipTabRowAboveMe but not = to 100?

If ShipTabCol1 = ShipTabRowAboveMe Then  'are they equal?'
     Exit For
End If

Open in new window

RWayneHAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
If ShipTabCol1 = ShipTabCol1.Offset(-1,0) And ShipTabeCol1 <> 100 Then
    ' Equal but not 100
End If

Open in new window

0
RWayneHAuthor Commented:
Thanks I am try a variant of this, but I cannot use an offset...  these are two defined. values being used in UFT and SAP.
Is there a way to write this without using the .offset?
0
Martin LissOlder than dirtCommented:
What do you mean when you say they are "defined values"?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

RWayneHAuthor Commented:
I think it was the use of the Or instead And.  Testing with
If ShipTabCol1 = ShipTabRowAboveMe And ShipTabCol1 <> "100" Then
0
RWayneHAuthor Commented:
Ok I am reversing the needed statement.  I need to Exit For in the following:

If Value1 and Value2 are equal   or
If Value1 is "" and Value2 is <>""
0
Martin LissOlder than dirtCommented:
If you really want "Or" then here are two ways to do it

If (Value1 = Value2) Or (Value1 = "" And Value2 <> "")

If (Value1 = Value2) Or (Value1 = "" And Value2 <> Value1)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RWayneHAuthor Commented:
Rats...  I forgot a piece.  When Value1 and Value2 are equal, it is ok only if they are both = to 100.
Do not Exit For if they are = to 100 only.  

so something like
If (ShipTabCol1 = ShipTabRowAboveMe and ShipTabCol1 <> "100") Or (ShipTabCol1 = "" And ShipTabRowAboveMe <> ShipTabCol1) Then

test this now.
0
RWayneHAuthor Commented:
Hear is the layout which probably would have help from the beginning.  Sorry
Need one If state that can cover the following.

Value1 = 100  and Value2 = 100,  Do not Exit For

The rest are Exit For,  one missed mismatch and the rest = to each other, just not = 100

Value1 = ""  and Value2 = 100,  Exit For
Value1 = 200  and Value2 = 200,  Exit For
Value1 = 300  and Value2 = 300,  Exit for
etc..

Hope this makes sense
0
RWayneHAuthor Commented:
Thanks for the help.
0
Martin LissOlder than dirtCommented:
If (Value1 = Value2 And Value1 <> 100) Or (Value1 = "" And Value2 = 100) Then
    Exit For
End If

Open in new window

0
Martin LissOlder than dirtCommented:
You're welcome and I'm glad I was able to help. My post above does exactly what you described in post ID: 40820730.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2015
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.