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 fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
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,215,515
Messages
6,125,279
Members
449,220
Latest member
Excel Master

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