Filter lists and ranges

Sheffwed

New Member
Joined
Jul 14, 2004
Messages
11
Currently I have a list of data that can be filtered. From a user form i have a combo box which uses this list, i also have a toggle button to turn on or off the filter. The problem that i have is that the combo box always displays the entire list and includes filtered cells.

The range of the combo box is set by the range name function and is:

='Live UHC Info'!$A$6:INDEX('Live UHC Info'!$A$6:$A$1500,MATCH(REPT("z",255),+'Live UHC Info'!$A$6:$A$1500))

Thanks in advance for any help you provide
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Your named range is based off the entire A6:A1500 range, regardless of what is hidden/filtered.

One thing you might try is to have VBA loop through A6:A1500 and put the visible cells into another sheet. Then, have your named range reference that new list instead.
 
Upvote 0
Hi,

I was hoping to avoid that as the list has about 200 columns worth of data and i'm trying to keep the file useable. Is there any way of ignoring the hidden rows which can be fed into the combo box source?

Thanks again for the help
 
Upvote 0
Clear the RowSource property and try something like this:

Code:
Private Sub UserForm_Initialize()
    Dim Sh As Worksheet
    Dim Rng As Range
    Dim c As Range
    Set Sh = Worksheets("Sheet1")
    Set Rng = Sh.Range("A6:A" & Sh.Range("A65536").End(xlUp).Row).SpecialCells(xlCellTypeVisible)
    For Each c In Rng
        ComboBox1.AddItem c.Value
    Next c
End Sub

Change the Sheet and ComboBox references to suit.
 
Upvote 0

Forum statistics

Threads
1,225,481
Messages
6,185,239
Members
453,283
Latest member
Shortm88

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