Replace your code in the command button1 with the following code:
Fltr = UserForm1.TextBox1.Value
shiptotest (Fltr)
This code will basically read what you have typed on the text box and then will call a sub called shiptotest passing the parameter you keyed in textbox1.
This is the code you want to populate textbox2:
Sub shiptotest(Fltr)
Columns("B:B").AutoFilter Field:=1, Criteria1:=Fltr
iLastRow = Range("K65536").End(xlUp).Row
i = WorksheetFunction.Sum(Range("K1:K" & iLastRow).SpecialCells(xlCellTypeVisible))
UserForm1.TextBox2 = i
End Sub
If this is helpful please click on the Star icon to add to user's reputation and also mark your question as answered
Bookmarks