Hiding Specific Rows Based on Values in Other Rows

C

Chris

I have a worksheet used for inventory. In Column A is the quantity (to
be entered manually). In Column B is the product description. In
Column C is the price of the product, and Column D the total price
(column C price x the quantity entered in Column A). At the bottom of
the worksheet is a grand total. Also, Column B (products) is grouped
into subheadings by the supplier each product came from (for example,
row 6 has the title PPG, and then rows 7-137 list every product from
PPG).

The calculations in this worksheet work fine. What I am trying to do
is, using a macro once all of the appropriate quantities are entered in
column A, automatically hide every row of product that does not have a
quantity. The tricky part is, if no products under a given supplier
subheader are entered, the subheader also hides, and if a quantity is
entered, that subheader shows. For example, if I have no quantities
under any products for PPG, then the PPG subheader hides, but if just
one quantity is added, PPG shows. Also, this list will be constantly
updated, new products will be put in and taken out all of the time, so
I cannot base the macro on a specific number of rows.

I am new to VB but being forced to learn very quickly due to this
project. Any suggestions?
 
R

Ron Coderre

Have you considered using an AutoFilter?

Select your data range...then...
From the Excel main menu:
<data><filter><autofilter>
That will put drop down arrows in each column title
Click on the drop down for Qty and select: non-blanks

That will hide all of the rows with blank qty fields.

Does that help?
***********
Regards,
Ron

XL2002, WinXP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top