abdelfattah
Well-known Member
- Joined
- May 3, 2019
- Messages
- 1,429
- Office Version
- 2019
- 2010
- Platform
- Windows
hello
i have this code but i no know where is the problem this message when popup it shows more one time please any idea to get rid of this problem
i have this code but i no know where is the problem this message when popup it shows more one time please any idea to get rid of this problem
VBA Code:
Private Sub TextBox3_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim f As Range
If TextBox2.Value = "" Then
MsgBox "Enter Brand"
TextBox2.SetFocus
Exit Sub
End If
If TextBox3.Value = "" Then Exit Sub
If TextBox3.Value <= 0 Or Not IsNumeric(TextBox3.Value) Then
Cancel = True
MsgBox "Enter a valid value"
Exit Sub
End If
Set f = Sheets("sheet1").Range("B:B").Find(TextBox2, , xlValues, xlWhole)
If Not f Is Nothing Then
If f.Offset(, 1) < Val(TextBox3) Then
MsgBox "Available is : " & f.Offset(, 1)
Cancel = True
Else
MsgBox "ok"
End If
Else
MsgBox "Brand does not exists"
TextBox2.SetFocus
End If
End Sub