abdelfattah
07-27-2021, 04:01 AM
hi
when I search in the internet like my question . I 've found theses codes but there is something . it doesn't work
the idea of code shows message when fill values in textbox1 after fill combobox1,2,3 they should match with col A,B,C if the values are filled in textbox1,2 bigger than what are existed in col D then should message box the value is exceeded and show the real value for specific item . so if any body can fix it or alternative code it will be a great
Function MatchingRowNumber(Brand As String, _
Typ As String, _
Origin As String) As Long
' 290
Dim Fun As Long
With Worksheet("List")
' search for the match here
' Fun interim result
End With
MatchingRowNumber = Fun
End Function
Private Function IsAvailable(ByVal Qty As Long) As Boolean
' 290
Dim R As Long
Dim AvailQty As Long
R = MatchingRowNumber(ComboBox1.Value, _
ComboBox2.Value, _
ComboBox3.Value)
AvailQty = List.Cells(R, "D").Value
If AvailQty < Qty Then
MsgBox "The quantity you entered exceeds availability." & vbCr & _
"Available quantity is " & AvailQty & ".", _
vbInformation, "Limited availability"
Else
IsAvailable = True
End If
End Function
Private Sub TextBox1_Change()
' 290
If IsAvailable(TextBox1.Value) Then
' continue with the program
Else
' return to the textbox
TextBox1.SetFocus
End If
End Sub
when I search in the internet like my question . I 've found theses codes but there is something . it doesn't work
the idea of code shows message when fill values in textbox1 after fill combobox1,2,3 they should match with col A,B,C if the values are filled in textbox1,2 bigger than what are existed in col D then should message box the value is exceeded and show the real value for specific item . so if any body can fix it or alternative code it will be a great
Function MatchingRowNumber(Brand As String, _
Typ As String, _
Origin As String) As Long
' 290
Dim Fun As Long
With Worksheet("List")
' search for the match here
' Fun interim result
End With
MatchingRowNumber = Fun
End Function
Private Function IsAvailable(ByVal Qty As Long) As Boolean
' 290
Dim R As Long
Dim AvailQty As Long
R = MatchingRowNumber(ComboBox1.Value, _
ComboBox2.Value, _
ComboBox3.Value)
AvailQty = List.Cells(R, "D").Value
If AvailQty < Qty Then
MsgBox "The quantity you entered exceeds availability." & vbCr & _
"Available quantity is " & AvailQty & ".", _
vbInformation, "Limited availability"
Else
IsAvailable = True
End If
End Function
Private Sub TextBox1_Change()
' 290
If IsAvailable(TextBox1.Value) Then
' continue with the program
Else
' return to the textbox
TextBox1.SetFocus
End If
End Sub