Excel VBA ActiveX Series #7 ListBox - Custom Fill A Listbox Any Way You Want
Вставка
- Опубліковано 16 бер 2013
- 📊 Free Workbooks: www.excelvbaisfun.com/links?u...
🥷Join Excel Ninja Pro: www.excelvbaisfun.com/ninjapr... Months FREE On Annual Plan Auto Applied)
🥷Excel Ninjas FB Group: www.excelvbaisfun.com/xlninjas (Free downloads, Trainings, Live Q&A and more)
This video demonstrates how you can fill a listbox with anything you want - and up to 10 custom columns. If you use a range/ named range, you can have many more columns, but at least this way you can fill with custom criteria. Check this out!
Fantastic Developer Tools:
🔒 Transform Any Excel File Into A Locked EXE: www.excelvbaisfun.com/secure-... (25% off with code ‘25OFF’)
🟡 Create Custom Installers: www.excelvbaisfun.com/custom-...
👋 Business Inquiries, Consulting, Comments, etc: www.excelvbaisfun.com/contact/
Just found your tutorial on UA-cam after surfing quite a bit. I like the way you teach! Even when I got a little lost as you broke down the nested loop portion, I was still able to get it because your visuals were fantastic. I plan to watch more of your tutorials. Thank you!
Thank you Raegan! Sorry if you got lost for a sec. God bless. Dan
Merry Christmas everyone. I hope God blesses you richly this upcoming year. Remember, you ARE a success!! Believe it, be it! Blessings my friends!! Dan
Imagine my excitement when I found this after searching through hundreds of forums.
THANK YOU !!!
Negru Sorin Dude!! So glad it helped!
An mol,
whatevers inputting in the listbox, make sure you use the round function or format function. example:
blah=Round(piVariable,2)
instead of blah = piVariable (or whatever)
using the round function should clean it up to whatever level of decimals you desire, standard is 2 decimal places.
Thanks Michael for you input. I'm really glad to hear that sir. Dan
Thanks Dan. I'm getting a lot out of your videos. Much appreciated!
This was really cool and useful, thanks bro
I also found this tutorial by searching for ListBox info. It is really, really great. Very easy to follow, and I like the way you run through your process as you think about the project.
I found that the "lrcode" throws an "Application-defined or object-defined error". I have no idea how to fix it. I've also downloaded Type Pilot and the code they now give for "lrcode" is entirely different. Using Excel 2010.
Hey Dan, thank you so much for posting this video.Related to this video, how about adding criteria instead of column 2 only.Is this possible, let say i would like to add column 3 as additional criteria.thanks and appreciate your kind inputs.
Thanks for your easy to understand vid..... Awesome!!! My next question is how could you make this work based on two criteria? So where you have East as one of the criteria, what if you wanted to filter between two dates for everything with east and then populate it to the listbox? Any chance you could help with suggestions? Have been racking my brain to try and make it happen but with no luck..... Thanks in advance
How to give a appearance of listbox like list of buttons? thank for your time!
Hello, I was wondering if it's possible to edit the data in the list box, or do you have to scroll down to the actual data set. I have a huge data set, so I wish to make it easier to edit by searching for one criteria like in the video.
Thanks
Is there a way to align certain columns in a list box either right or left, each column separately? So for example all the dates and dollar amounts will be aligned right and the text will be aligned left.
LifeSaver! Thanks a ton.
Hi Dan, thanks for sharing a great video! Just wanted to ask if you provide the excel file with the vba code ?
THIS WOULD BE GREAT, THANKS - WE BELIEVE
Nice one bro
Thank you for this great tutorial, it helped me a lot but there is only 1 problem... and i am sure it is very very easy but i couldnt handle it. On 0:34 you hide the headers but i want to show the headers. The problem is i couldnt define my Row=1 as a header so i see nothing at the Listbox's header section. I keep searching but couldn't find.
This tutorial really helped me out, but I have a question. In the beginning, you almost didn't add a button to trigger the event. I have a workbook where I have a Category, a Subcategory, and a Part number. The first userform lets me select a category, then another userform loads so I can select from just the subcategories within the selected category. It unloads Userform1, shows userform 2, and then i have to click the button to get that userform2 to populate with the subcats associated with the cats selected. How can I make it so that I don't have to click a button - the listbox in userform2 updates automatically when the userform2 opens? Thanks.
Hi Dale! Great question. There are a couple ways that come to mind. You can use a Userform_Initialize() event procedure that will run when userform2 is opened OR you can make things populate in userform2 from the code within userform1 before unloading it. Example for 2nd method:
userform2.lblName = userform1.tbName
userform2.tbSalary = userform1.lblSalary + 1000
etc. . .
Lemme know if that answered your question,
Dan
Thanks
Hello I have one quick question.
I have result being displayed in listbox i.e 3.141592654 and I want it to display something like 3.14. How do i do that ?
Thanks
Hi Dan! This helped a lot, thanks! I can't work it out though. I have my list box in a userform in a sheet and in different sheet is the database with the information to populate the listbox -same workbook. What do I need to change in the "cells" part to refer to this different sheet?
here is what I did:
Private Sub boxFamilia_Change()
criterio = BoxFamilia.Text
Dim x As Long
On Error Resume Next
If Sheets(Arquivos).Cells(Rows.Count, 1).End(xlUp).Row = 1 Then
ultimaLin = 2
Else
ultimaLin = Sheets(Arquivos).Cells(Rows.Count, 1).End(x1up).Row
End If
For x = 2 To ultimaLin
If Sheets(Arquivos).Cells(x, 2) = criterio Then
'I only need the first column to show in the listbox
Me.ListIndividuos.AddItem Sheets(Arquivos).Cells(x, 1)
End If
Next x
End Sub
Thank you very much!
julibgodinho If you're getting an error, you'll need to put Arquivos in quotes,
so instead of Sheets(Arquivos)
try
Sheets("Arquivos")
with the quotation marks. Should be fine then.
Dan
ExcelVbaIsFun Thank you very much Dan! I figure it out and its working perfectly. Your video saved me after 2 months trying to program this listbox thing! I also would like to increase the security of the sheets containing the database, in this case, Sheets("Arquivos"). Is it possible that you do a video explaining us how to keep your database as secure as possible? In my case, my VB code let users add contacts to a database and then consult one a time. I would like to keep users from viewing the complete database. Right now, I'm only hiding the sheet. Is there a way they are not allow to unhide it?
Thanks again!
Why is the Resolution very kow
Hello, I was wondering if it's possible to edit the data in the list box, or do you have to scroll down to the actual data set. I have a huge data set, so I wish to make it easier to edit by searching for one criteria like in the video.
Thanks