If my length of character of text box value vary, from product to product then below is not working.File is attached.
[VBA]
If Len(Me.TB1.Value) <> 12 Then Exit Sub
[VBA]
please help me
[VBA]
rivate Sub TB1_Change()
Dim rng As Range
If Len(Me.TB1.Value) <> 12 Then Exit Sub
With ThisWorkbook.Sheets("Stock")
Set rng = .Range("A:A").Find(Me.TB1.Value, , xlValues, xlWhole)
If Not rng Is Nothing Then
Me.PN.Caption = rng.Offset(0, 1)
Me.LOC.Caption = rng.Offset(0, 3)
Me.QTY.Caption = rng.Offset(0, 2)
Else
MsgBox "Part Number Not Available "
End If
End With
Me.TB1.SelStart = 0
Me.TB1.SelLength = Len(Me.TB1.Value)
End Sub
[VBA]
Bookmarks