• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 346
  • Last Modified:

How to get max number of items in a slicer list box

I've been given a workbook that has a few slicer controls (They look like slicer controls) on the first sheet.  I am not familiar with slicer.  They are both list boxes and the two lists I'm interested in are the state selection list and the county selection list.  When I select a state in the state list, it brings up all of the counties in that state in the county list.  Then I select a county and the screen updates with that county information.  I need to write a program that loops through all states and all counties.  The states and counties are listed on another worksheet and have sequential numbers associated with them.  So there are 50 possible states and any number of counties per state.  How can I get the maxiumum number of counties for that state so I can use that number in my loop?  When I right click the state control it tells me where the state values are coming from (Another worksheet -- Cell Link "E5").  Same with counties.  If I query the county value in the immediate window it only returns the value of the county.  I need to access the list of counties for that state so that I can loop through them.  Any ideas?
2 Solutions
NorieVBA ExpertCommented:
I've never heard of a slicer control.

I was going to suggest you might have meant slider controls but your further description involving list sounds more like listboxes or comboboxes.

If they are comboboxes/listboxes when you right click there should also be a property called Input Range.

The range there will be where the list you want will be - the Cel Link property is a cell on the worksheet where the value selected goes.

The Cell Link is probably on the same worksheet as the control, while the Input Range, with the list(s) you want, will probably be on another sheet.
Is this a one time event, or something that will need to be able to be done programically for future workbooks?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now