View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Cathy Cathy is offline
external usenet poster
 
Posts: 104
Default unhide rows based on data validation

PERFECT!! Thank you VERY much!!!
--
Cathy


"Rick Rothstein (MVP - VB)" wrote:

Actually, it looks like the EntireRow qualifier is not required with a call
to Rows... this seems to work fine...

Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
If Range("E30").Value = "0" Then
Rows("144:238").Hidden = True
ElseIf Range("E30").Value = "1" Then
Rows("144:238").Hidden = False
End If
Application.ScreenUpdating = True
End Sub

Rick


"Rick Rothstein (MVP - VB)" wrote in
message ...
Give this a try...

Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
If Range("E30").Value = "0" Then
Rows("144:238").EntireRow.Hidden = True
ElseIf Range("E30").Value = "1" Then
Rows("144:238").EntireRow.Hidden = False
End If
Application.ScreenUpdating = True
End Sub

Rick


"cathy" wrote in message
...
I have a data validation list in cell $E$30 of either "0" or "1".

If the user selects "0" I want to hide rows 144 - 238.
If the user selects "1" I want rows 144-238 to appear.

I tried the following code - but it didn't seem to work. Any help is
appreciated.

Private Sub Worksheet_Change(ByVal Target As Range)

Application.ScreenUpdating = False
If Range("E30").Value = "0" Then
Range(Rows(144), Rows(238)).EntireRow.Hidden = True
ElseIf Range("E30").Value = "1" Then
Range(Rows(144), Rows(238)).EntireRow.Hidden = False:
End If
Application.ScreenUpdating = True
End Sub
--
Cathy