ActiveX ComboBox dynamic range for ListFillRange

mrwad

New Member
Joined
Oct 16, 2018
Messages
49
I have `ThisWorkbook.Sheets("MAIN")` and ActiveX `ComboBox11` on it. I also have table:


Code:
             A                    B 
    1      John 1               10000
    2      John 2               20000
    3      John 3               20000
    4      John 4               10000
    5      John 5               50000
    6      John 6               50000
    7      John 7               50000
    8      John 8               10000
    9      John 9               20000
    10     John 10              50000

Then in cell Q10 I have value, let's say 32000


I would like to display column A range dynamically in ActiveX `ComboBox11` with condition:


Code:
=IF(B1<Q10;"not in list";A1))

so that I would not have values less than 32000 in ActiveX `ComboBox11` drop down.


In this case ActiveX `ComboBox11` would look like:




Code:
    John 5
    John 6
    John 7
    John 10



It is easy to have named range in ListFillRange. However I would like to have dynamic range. Any ideas how to achieve that?


I need to use filter somehow?


Code:
    Private Sub Worksheet_Change(ByVal Target As Range)
    
       'If Target.Address = Range("Q10").Address Then
           'Range("A1:B10").CurrentRegion.AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Range("B1:B10")
       'End If
    
    End Sub

And after that use filtered range in ActiveX `ComboBox11` ListFillRange?

Also asked here: https://stackoverflow.com/questions/55730455
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
I have used empty cells ""

and this code

Code:
Private Sub Worksheet_Change(ByVal Target As Range)


   'If Target.Address = Range("E216").Address Then
       'Range("A219:E235").CurrentRegion.AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Range("E219:E235")
   'End If
Dim c As Range
ThisWorkbook.Sheets("MAIN").ComboBox11.Clear
With ThisWorkbook.Sheets("Contact database")
    For Each c In .Range(.Range("A219"), .Range("A" & .Rows.Count).End(xlUp))
        If c.Value <> vbNullString Then ThisWorkbook.Sheets("MAIN").ComboBox11.AddItem c.Value
    Next c
End With
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,935
Members
449,094
Latest member
teemeren

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