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

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

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?
Martin LissOlder than dirtCommented:
What do you mean when you say they are "defined values"?
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

RWayneHAuthor Commented:
I think it was the use of the Or instead And.  Testing with
If ShipTabCol1 = ShipTabRowAboveMe And ShipTabCol1 <> "100" Then
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 <>""
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)

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.
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

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

Open in new window

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
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.