Filtering data into a userform listbox

JonnyAngelo

New Member
Joined
Dec 11, 2017
Messages
35
Hi!

Apologies for a bit of a nooby thread, I'm super new to VBA.
Simply put, I have created this userform and want it to show data within a listbox in the userform.
The data I have is stored on a worksheet and I want the listbox to also list new data once added to
the worksheet. The filtered options i have are from 8 combo boxes that I have added to the userform.
I also have a filter button which I would like to use once filling in the combo boxes to show the
filtered data on the listbox.

Here's an image of my userform so that you have an idea:

https://imgur.com/a/FOcUh

I've tried searching through methods such as Advanced Filtering and such but couldn't manage to get
ways to work with it. Any help is immensely appreciated.

Thanks, Jonny
 
Is this a single column ListBox or a Multicolumn listbox

And what do you plan to do with all this data after you see it in the listbox.
 
Upvote 0

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
You said your one combobox was named:

DSS / Private

But that is not a legal name for a combobox
 
Upvote 0
It is multi column.
As for what i plan to do with the data, i'm not entirely sure. I'm possibly going to find a way in which it can open when
clicked on so that i can view the information. For now, I'm just trying to figure out how to get it listed.
 
Upvote 0
My bad, i mistook it for the labels, the 8 comboboxes are:

cbDSS
cbContract
cbType
cbIncl
cbFloor
cbMais
cbKitch
cbGar
 
Upvote 0
You said you want all columns from A to T

to be shown in the listbox

This is 20 columns of data
And I have limited knowledge of Multicolumn listboxes

And when you say you have a muticolumn listbox

And I assume you want a 20 column listbox
But your not even sure what you plan to do with this data.
It's difficult to use data like this other then look at it unless you have a lot of code to exact certain rows and certain columns of data


I may need to let someone else here help you.
 
Upvote 0
Essentially, I want to use the data as reference.
In simple terms, Say if i enter values for some of the 8 comboboxes, I'd click the filter button and data matching those values would appear.
Once i have the data shown on screen, as the data is for contacts and housing properties, i would use it as reference to find contact details for example.
Not sure if i'm being clear enough but imagine this scenario:

I'm looking for a property, i input values that work well with me (I.E. i want a 2 Bedroom House and i also want a Garden with it)
So i would select these options. Once data has come up within the Listbox, i would be able to view a Landlord's name and contact details.
From there, I'd be able to use it as reference and contact the Landlord with these details.

Apologies for being unclear. Also, thank you so much for your cooperation.
 
Upvote 0
Hi Jonny:

Take a look at this file: Dropbox file which is doing essentially what you want to do with your data. I am using the Autofilter to parse the data as selected by the user via comboboxes and/or a date range then displaying the results in a multicolumn listbox. Look at the Search Module in VBA and hopefully you can glean some ideas from that. Feel free to ask any questions about this.

Regards,

CJ
 
Upvote 0
Hello CJ,

Impressive pieces of work. I indeed am trying to do something similar.
As for your search module, i seem to have found a few bits of code that may possibly help me however,
like I've said before, I'm pretty new to VBA and may need some assistance on to understanding what some parts of your code does.

Thanks, Jonny.
 
Upvote 0
Apologies for the timed reply, what exactly does this section of the code do:
Code:
Sub SearchRecords()
    On Error GoTo ErrorHandler  ' Enable error-handling routine.
    
    With Application
        .Calculation = xlCalculationManual
        .ScreenUpdating = False
        .DisplayStatusBar = False
        .EnableEvents = False
        .Cursor = xlWait
    End With
    
    ctype = SearchSettings!CutType.Value
    ctypeli = SearchSettings!CutType.ListIndex
    Cust = SearchSettings!Customer.Value
    custli = SearchSettings!Customer.ListIndex
    Size = SearchSettings!Size.Value
    sizeli = SearchSettings!Size.ListIndex
    Size2 = SearchSettings!Size2.Value
    size2li = SearchSettings!Size2.ListIndex
    Mtrl = SearchSettings!Mtrl.Value
    mtrlli = SearchSettings!Mtrl.ListIndex
    tmtrl = SearchSettings!TrodeMtrl.Value
    tmtrlli = SearchSettings!TrodeMtrl.ListIndex
    date1 = SearchSettings!DTPicker1.Value
    date2 = SearchSettings!DTPicker2.Value
    daterli = SearchSettings!DateRestrict.ListIndex


    'Set Units
        If SearchSettings.English.Value = True Then
            units = "English"
        Else: units = "Metric"
        End If
 
Upvote 0

Forum statistics

Threads
1,224,825
Messages
6,181,190
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top