Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need help with a macro referencing a range!

Status
Not open for further replies.

bjcal

Technical User
Mar 13, 2002
1
US
To whom ever can help,
I am trying to write a marco that will reference a range. I have a spreadsheet that has over 1,000 rows of data. The data is classified as x,y,z in column A. The data is also ranked by sales volume. What I would like to do is have a button/dropdown box that when you select x,y,or z only rows of data that have been classified as z show up. All other rows of data will be hidden.
They only way I currently know how to do this, is to say hide all rows, then unhide row 1 if cell A1 is z. Of course I would have to right this for 1,000 rows. Is there a way to reference the data range and only have certain rows visible?

Thanks for your help!!!!
bjcal
 
Do you need to do this in VBA? There is a built-in function in Excel that does just that. Try Data>Filter>AutoFilter.
Once turned on, there will be a dropdown in each column. Just select x, y, or z from the dropdown and Excel does the rest.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top