Hi
I search for way when search the item based on column D into textbox1 and populate the data in listbox should get the last balance from the last row is existed in listbox for the last column in listbox (H), and populate the last balance into textbox2
should not summing , just brings the last value from the last row for the last column in listbox to textbox2 .
here is the code
I search for way when search the item based on column D into textbox1 and populate the data in listbox should get the last balance from the last row is existed in listbox for the last column in listbox (H), and populate the last balance into textbox2
should not summing , just brings the last value from the last row for the last column in listbox to textbox2 .
here is the code
VBA Code:
Private Sub Searchbutton_Click()
With Sheets("Inventory List")
If IsError(Application.Match(TextBox1.Text, .Columns(4), 0)) Then MsgBox "Modelnumber not found!": Exit Sub
r = .Range("A3", .Range("H" & .Rows.Count).End(xlUp)).Resize(, 9)
End With
With ListBox1
.List = r
.ColumnCount = UBound(r, 2)
For i = 0 To .ListCount - 1
.List(i, .ColumnCount - 1) = i + 3
Next
For i = .ListCount - 1 To 0 Step -1
If UCase(.List(i, 3)) <> UCase(TextBox1.Text) Then .RemoveItem i
Next
End With
End Sub