Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default hide zero rows / shadwe every other visible

Hi everyone. I found this code on the newsgroup from Tom Ogilvy. The
hidig of the cells workd great, but I can't seem to get the shading of
every other visible row. Any ideas what I'm doing wrong? Thanks!

Dim Cell As Range
Dim i As Long
Set Sh = ActiveSheet
Application.ScreenUpdating = False
With Sh
'----------Hide rows where B's value is zero----------
.Range("A7:L160").Interior.ColorIndex = xlNone
i = 1
For Each Cell In .Range("B7:B160")
If Cell.Value = 0 Then
Cell.EntireRow.Hidden = True
Else
Cell.EntireRow.Hidden = False
If i = 1 Then
Cell.Offset(0, -1).Resize(1, 11). _
Interior.ColorIndex = 37
End If
i = (i + 1) Mod 2


End If
Next Cell
End With

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default hide zero rows / shadwe every other visible

Never mind! Stupid mistake on my part!! Thanks.


On Oct 10, 11:45 am, Steve wrote:
Hi everyone. I found this code on the newsgroup from Tom Ogilvy. The
hidig of the cells workd great, but I can't seem to get the shading of
every other visible row. Any ideas what I'm doing wrong? Thanks!

Dim Cell As Range
Dim i As Long
Set Sh = ActiveSheet
Application.ScreenUpdating = False
With Sh
'----------Hide rows where B's value is zero----------
.Range("A7:L160").Interior.ColorIndex = xlNone
i = 1
For Each Cell In .Range("B7:B160")
If Cell.Value = 0 Then
Cell.EntireRow.Hidden = True
Else
Cell.EntireRow.Hidden = False
If i = 1 Then
Cell.Offset(0, -1).Resize(1, 11). _
Interior.ColorIndex = 37
End If
i = (i + 1) Mod 2

End If
Next Cell
End With



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make a few rows visible and hide some others ... faster tskogstrom Excel Programming 2 October 5th 07 07:39 PM
Hide a visible rows Wanna Learn Excel Discussion (Misc queries) 5 February 15th 07 09:23 PM
excel hide and visible problem Pierre via OfficeKB.com[_2_] Excel Programming 1 November 7th 05 01:09 PM
Hide (visible+AD0-false) all open applications? Joe 90[_2_] Excel Programming 0 October 23rd 03 07:12 PM
Hide (visible+AD0-false) all open applications? Joe 90[_2_] Excel Programming 0 October 23rd 03 02:00 AM


All times are GMT +1. The time now is 03:00 AM.

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

About Us

"It's about Microsoft Excel"