I know the answer is likely a simple one, but I have been staring at this for long enough to no avail.
My first iF statement works beautifully, but the 2nd and 3rd are disregarded. I am thinking I need Elseifs, but they aren't playing nice!
Any help would be greatly appreciated!
My first iF statement works beautifully, but the 2nd and 3rd are disregarded. I am thinking I need Elseifs, but they aren't playing nice!
Any help would be greatly appreciated!
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'checks for valid part #
If IsEmpty(Range("B1")) = False And Range("G1") = 1 Then
MsgBox "The Part you have entered is invalid, please write down the part #, Qty and Location for JD to research further", vbOKOnly
Range("B1").ClearContents
Exit Sub
'checks for valid quantity
If IsEmpty(Range("B2")) = False And Range("G2") = False Then
MsgBox "You have entered an invalid quantity, please try again", vbOKOnly
Range("B2").ClearContents
Exit Sub
'if part and quantity are valid, calls add to inventoryt sub
If IsEmpty(Range("B1")) = False And Range("G1") <> 1 And IsEmpty(Range("B2")) = False And Range("G2") = True Then
Sheets("Control Data").Range("B1:B3").ClearContents
Call Sheet1.AddtoInv
Exit Sub
End If
End If
End If
End Sub