View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Marcel[_2_] Marcel[_2_] is offline
external usenet poster
 
Posts: 3
Default If then else if problem for DA

I'm not quite sure what you want to achieve, how are these different
ranges you wish to hide/unhide related to one another, are they just
below one another for example?

Here's something that MIGHT help you along a little bit. In one of my
sheets, I have approx. 14 ranges of 13 rows (1 title and totals and 12
months). To hide/unhide the monthly rows, depending on the hidden/
unhidden property of the title row:

Dim IntMndZb(1 to 12) as Integer, Smallrng as Range

For i = 1 To 12

If IntMndZb(i) = 1 Then 'IntMndZb is the variable I use to keep
track of whether Month X should be visible at all
For Each Smallrng In
Range("B4,B18,B32,B46,B60,B74,B88,B102,B116,B130,B 144,B158,B172,B186,B200,B214")
If Smallrng.Rows.Hidden Then
Smallrng.Offset(i, 0).EntireRow.Hidden = True
Else
Smallrng.Offset(i, 0).EntireRow.Hidden = False
End If
Next Smallrng
Else
For Each Smallrng In
Range("B4,B18,B32,B46,B60,B74,B88,B102,B116,B130,B 144,B158,B172,B186,B200,B214")
If Smallrng.Rows.Hidden Then
Smallrng.Offset(i, 0).EntireRow.Hidden = True
Else
Smallrng.Offset(i, 0).EntireRow.Hidden = True
End If
Next Smallrng
End If
Next i


If your ranges are easily identified, e.g.
Range("HideMonthlyRowsIfOnlyTwoHurdles") is always one row below the
'IfOnlyThree' and two rows below 'IfFourHurdles", a loop like this
might help.

Good luck, Marcel