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

Hi Jim,

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).


Granted that there is potential ambiguity, my response was predicated on the
OP's statement:

I have a spreadsheet which contains a lot of rows with no data.


Which interpretation is correct can only be resolved by the OP, but at least
he now has solutions to deal with either eventuality.

---
Regards,
Norman



"JMay" wrote in message
news:oVSqf.84061$WH.53867@dukeread01...
Let's back up here.
If a cell has a 0 (zero) in it, it is not blank.


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?