Macro to hide rows.

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

I have a stock order form. I want to find a way to hide
rows containg items that do not need to be ordered. for
example:

A B
1 paper 2
2 ink
3 pens 4
4 staples

Is there a macro that can filter out empty quantity celss
and hide the whole row (rows 2 and 4 in this instance)?
I appreciate your time and effort.
Steve.
 
Hi Steve

I would use Filter / Autofilter for this (goto "Data - Filter") and
filter all 'non blanks#

HTH
Frank
 
What do you want to do with the rows that are left visible. Do you want to
print them? Copy them? Just look at them? HTH Otto
 
The document is a fax form.
-----Original Message-----
What do you want to do with the rows that are left visible. Do you want to
print them? Copy them? Just look at them? HTH Otto



.
 
One way:
Say that Column B is the column that contains the criteria for hiding the
rows. That is, you want to hide all the rows that are blank in Column B.
Say your data goes from B1 to B50. Select B1:B50. Hit the F5 key (the GoTo
key), click on Special at the bottom of the GoTo box. Click on the radio
button for blanks. Click OK. All the blank cells in B1:B50 will now be
selected. Run the following macro. It will hide all the rows that are
blank in B1:B50.
HTH Otto
Sub HideBlankRows()
Dim i As Range
For Each i In Selection
i.EntireRow.Hidden = True
Next i
End Sub
 
Back
Top