View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Hide / Unhide each row from StartRow to LastRow for multiple conditions

Hi J.P.,

Am Sat, 31 Jan 2015 06:55:20 -0800 (PST) schrieb JeanPierre Charron:

Simulation Test
Col B Col C Col D Col E
100 50 200 350 Not Hideable on Button_Click
=50 50 0 0 Not Hideable " " "
0 0 0 0 Hide / Unhide " " "
0 Hide / Unhide " " "


try:
Sub Hide()
Dim varData As Variant
Dim i As Long

With ActiveSheet
varData = Intersect(.UsedRange, .Range("B:E"))
For i = 1 To UBound(varData)
If WorksheetFunction.Sum(Application.Index(varData, i, 0)) = 0
Then
.Rows(i).Hidden = True
End If
Next
End With
End Sub

Sub Unhide()
With ActiveSheet
.UsedRange.EntireRow.Hidden = False
End With
End Sub


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional