A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Macro to hide rows with zero in specifc column range



 
 
Thread Tools Display Modes
  #1  
Old April 20th, 2010, 07:40 PM posted to microsoft.public.excel.misc
David
external usenet poster
 
Posts: 1,494
Default Macro to hide rows with zero in specifc column range

Hello

I have a workbook with multiple sheets. I would like to put together a
macro that will hide the rows in a given range on all sheets. For example,
on Sheet 1 the range of cells I need to evaluate for zero are C9:63. If any
of the cells in the range are zero, I want to hide the corresponding row. So
if C11 is zero, row 11 is hidden. I would repeat the macro for the same
ranges on Sheet 2, 3, 4,...

Any help is appreciated.

Thanks
  #2  
Old April 20th, 2010, 08:10 PM posted to microsoft.public.excel.misc
Luke M[_4_]
external usenet poster
 
Posts: 451
Default Macro to hide rows with zero in specifc column range

Sub HideRows()
For Each sh In ThisWorkbook.Worksheets
For Each c In sh.Range("C9:C63")
If c.Value = 0 Then
c.EntireRow.Hidden = True
Else
c.EntireRow.Hidden = False
End If
Next c
Next sh
End Sub

--
Best Regards,

Luke M
"David" wrote in message
...
Hello

I have a workbook with multiple sheets. I would like to put together a
macro that will hide the rows in a given range on all sheets. For
example,
on Sheet 1 the range of cells I need to evaluate for zero are C9:63. If
any
of the cells in the range are zero, I want to hide the corresponding row.
So
if C11 is zero, row 11 is hidden. I would repeat the macro for the same
ranges on Sheet 2, 3, 4,...

Any help is appreciated.

Thanks



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:44 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.