Lisa_K Posted February 12, 2021 Share Posted February 12, 2021 (edited) Jag har ett formulär där jag skall kunna söka efter mina produkter men nu kan jag bara söka från en kolumn och då bara få fram en uppgift. Jag skulle även vilja kunna söka på produkt numret i samma ruta. Produkt numret finns i kolumn F Sub Show_Product() Dim sh As Worksheet Set sh = ThisWorkbook.Sheets("Product Master") Dim i As Integer Me.ListBox1.Clear For i = 2 To Application.WorksheetFunction.CountA(sh.Range("A:A")) If Me.TextBox1.Value = "" Then Me.ListBox1.AddItem sh.Range("A" & i).Value Else If VBA.InStr(UCase(sh.Range("A" & i).Value), UCase(Me.TextBox1.Value)) > 0 Then Me.ListBox1.AddItem sh.Range("A" & i).Value End If End If Next i End Sub Kanske skall tillägga att det är inte jag som skrivit koden. Hittade den på nätet men ville modifiera den lite kom jag på. Edited February 12, 2021 by Lisa_K Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now