Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88126

VBA : Textbox Searchbar and Listbox - 3 - R1

$
0
0

We have 4000 diffrent materials/equipments in our stock.

We are using VBA stock macro which is integrated with barcode scanner. Via this stock macro, we make all the stock process.

Over this VBA stock macro, we have a chance to summarize all the diffrent materials/equipments to another workbook separately thanks to VBA codes. ( Let's say Summary Workbook )

Want to see how many diffrent pipes we have and how many meter of pipes we have in our stock, you should click "PIPES" sheet inside of Summary Workbook. For "ELECTRICAL MATERIALS", "FLANGES", "FITTINGS", "ASSETS" and the nearly other 20 stock group its all the same. All the titles are separated and they are all the diffrent pages as a list.

Also i list all the titles ( I mean ELECTRICAL MATERIALS", "FLANGES", "FITTINGS", "ASSETS","PIPES" etc.) to just another one sheet all together too ( Let's say DATA Sheet ). The main idea in here is : Use this sheet as a data list.

All the above operation purpose is checking materials/equipments quantity easily and how many diffrent product we have in our stock to see. But when you open the "Summary Workbook" it got complicated to check. Every stock group at least includes 150 diffrent materials/equipments.

So i just created another sheet in Summary Workbook and named it : Main Sheet. Besides i create a textbox and a listbox in it.

I choosed all the stock information inside of the DATA sheet from ( A2:F4214 ) named them "DATA". So when i choosed the listbox on the main sheet, i achieved to transfer all the "DATA"'s via using "ListFillRange" method.

By the way i use 6 column head.

1- Number 2- Barcode No. 3- Stock Group Name 4- Stock Name 5- Stock Quantity 6- Stock Measurement ( Meter, Piece, Set, Liter etc.)

I used below code to use textbox as a Search Box :

Private Sub TextBox1_Change()

Dim i As Long
Me.TextBox1.Text = StrConv(Me.TextBox1.Text, 1)
Me.ListBox1.Clear
For i = 2 To Application.WorksheetFunction.CountA(Sayfa281.Range("D:D"))
a = Len(Me.TextBox1.Text)
If Sayfa281.Cells(i, 4).Value Like "*"& TextBox1.Text & "*" Then
Me.ListBox1.AddItem Sayfa281.Cells(i, 4).Value
Me.ListBox1.List(ListBox1.ListCount - 1, 4) = Sayfa281.Cells(i, 4).Value
End If
Next i

End Sub

It gave :

Run time error '- 2147467259(80004005)': Unspecified error.

When i clicked DEBUG, it shows Me.ListBox1.Clear in yellow.

Actually when i used above code inside of an userform, it works very well but in excel sheet unfortunately it did not work.

Could someone help me or could someone guide me the solve the problem?

I hope my summary is clear.

Thanks in advance.


Viewing all articles
Browse latest Browse all 88126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>