View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.misc
JMay
 
Posts: n/a
Default Macro for hiding rows

Let's back up here.
If a cell has a 0 (zero) in it, it is not blank.

It looks like all or most of the suggestions offered here
has been if cells are Blank. But, I see that you "prefer"
if rows are 0 (zero value).

Before running this macro select (highlight) your intended range, say G2:G1000
<< Using Selection make the macro a bit more useful.

In a standard module put:

Sub HideRowsWithZero
For Each c In Selection
If c.Value = 0 Then
c.EntireRow.Hidden = True
End If
Next c
End Sub


Hope that Helps,








"KL" wrote in message
...
another way without macros:

1) select one of the columns where empty cells correspond to empty rows
2) menu EditGoto... 3) press the button 'Special...'
4) mark the 'Blanks' option and press 'OK'
5) menu FormatRowsHide...

or using short cut keys:

1) having the cursor in a cell of the relevant column press Ctrl+Space
2) Ctrl+g
3) Hold Alt+ s, k, 4) Enter
5) Hold Alt + o, r, h

Regards,
KL


"Luke" wrote in message
...
I have a spreadsheet which contains a lot of rows with no data, I would like
to create a macro to hide these rows.

Preferably I would like it to work off one column and hide any rows with a
value of zero.

Any ideas?