lundi 18 janvier 2021

How to nest Less than and greater than in one code

Im in a dilemma here which I just cant seem to put my finger on it. You pro vba users might be able to help.

Basically I am trying to show that finished goods bottles - raw bottles has limits. as shown below. If total has more than 208 raw bottles used for finished goods then no-go message, if less then proceed. But at the same time if 50 bottles less of raw bottles to make the finished goods then no-go message.

So If finished goods = 4000 raw bottles = 4212

Message will show 212 bottles no go message

If finished goods = 4000 raw bottles = 3949

message should show 51 bottles no go message

    If Abs(.Cells(21, 3)) < 208 Or Abs(.Cells(21, 3)) < -50 Then
    
        '# Display "go" message
       .Cells(7, 5) = "All good, you may proceed to enter figures in EZY."

    Else
    
        '# Display "no-go" message
        .Cells(7, 5) = "there is " & .Cells(21, 3) & " bottles less from Depal, do not enter in EZY!"
                                                    
    End If 'Check

I hope this makes sense. Can I nest the greater than and less than or do I type another code below it? If I remove 'Or Abs(.Cells(21, 3)) < -50' the whole code works but only for upper limit.

Aucun commentaire:

Enregistrer un commentaire