I think it would be in your xtBatchNo_Exit event.
Something like....
Private Sub TxtBatchNo_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim ws As Worksheet, sh As Worksheet
Dim Rws As Long, Rng As Range, c As Range, lookRng As String
Set ws = Worksheets("StockDatabase")
Set sh = Worksheets("WithdrawDatabase")
With ws
Rws = .Cells(Rows.Count, "E").End(xlUp).Row
Set Rng = .Range(.Cells(1, "E"), .Cells(Rws, "E"))
End With
lookRng = Me.TxtBatchNo
Set c = Rng.Find(what:=lookRng, lookat:=xlWhole)
If Not c Is Nothing Then
MsgBox c.Offset(0, -1) - Me.txtQty.Value 'edit this to do what you need.
Else: MsgBox "Not Found"
Exit Sub
End If
End Sub
Bookmarks