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

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
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,223,880
Messages
6,175,154
Members
452,615
Latest member
bogeys2birdies

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