combobox list

jerichey

New Member
Joined
Jan 14, 2019
Messages
4
Hello,
I have a combobox that is populated from a column(C) in a worksheet. I only want items from that column to show in the dropbox if a value in a corresponding column(F) is greater than zero. is there a way to do this? here is the code that populates the dropbox.

Code:
Private Sub cbproducttype_Change()




With Worksheets(cbproducttype.Value)
    cbltnbr.List = Sheets(cbproducttype.Value).Range("c:c").Value
End With


End Sub
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Hi & welcome to MrExcel
How about
Code:
Private Sub cbproducttype_Change()
   Dim Dic As Object
   Dim Cl As Range
   
   Set Dic = CreateObject("scripting.dictionary")
   With Worksheets(cbproducttype.Value)
      For Each Cl In .Range("C2", .Range("C" & Rows.Count).End(xlUp))
         If Cl.Offset(, 3).Value > 0 Then
            Dic.Item(Cl.Value) = Empty
         End If
      Next Cl
      cbltnbr.List = Dic.Keys
   End With
End Sub
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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