View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
keiji kounoike keiji kounoike is offline
external usenet poster
 
Posts: 199
Default Hide, unhide macro

One way to hide rows automatically is to use Workbook_SheetActivate
event. Copy Sub Workbook_SheetActivate and Function leapyear code below
into ThisWorkBook Module. then move to any sheets and check this would
work or not.
but I'm not sure if this could satisfy your request.

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim ye As Long
Dim shFeb As Worksheet, shAnu As Worksheet
ye = Range("BloodYear")
Set shFeb = Worksheets("February Tests")
Set shAnu = Worksheets("Annual Blood Pressure Data")
If leapyear(ye) Then
shFeb.Rows(42).Hidden = False
shAnu.Rows(70).Hidden = False
Else
shFeb.Rows(42).Hidden = True
shAnu.Rows(70).Hidden = True
End If
End Sub

Function leapyear(ByVal year As Long) As Boolean
If ((year Mod 4) = 0 And (year Mod 100) < 0) Or (year Mod 400) = 0 Then
leapyear = True
Else
leapyear = False
End If
End Function

Keiji

Archimedes' Lever wrote:
On Sat, 13 Jun 2009 15:33:38 -0500, "Don Guillett"
wrote:

If desired, send your file to my address below along with this msg and
a clear explanation of what you want and before/after examples.



My first post has a link to my spreadsheet in it.