That was exactly my first part of question - as your Sub is in standard module, it knows nothing about such object as TextBox1.
So either let vba know where to look for textbox1:
MsgBox ("There are currently " & Application.WorksheetFunction.VLookup(Val(UserForm1.TextBox1.Value), Sheets("Inventory").Range("a3:z1000"), 2, False) & " in stock")
or (suggested solution) move your whole Sub EditAdd() to userform1 code (where for instance your Private Sub CommandButton5_Click() resides)
PS. Working with vlookup this way can easily cause execution time errors (when no itemnumber is found in column A) - so some error handling would be wise idea like (version to be inserted in UserForm code (for standard module remember about Userform1. prefix)
Sub EditAdd()
On Error Resume Next
MsgBox ("There are currently " & Application.WorksheetFunction.VLookup(Val(TextBox1.Value), Sheets("Inventory").Range("a3:z1000"), 2, False) & " in stock")
If Error <> 0 Then MsgBox TextBox1.Value & " not found", vbCritical
On Error GoTo 0
End Sub
Bookmarks