Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi...
If I enter 1 into cell A1 I want to automatically hide rows 8-19. Is this possible? Cheers G |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Gordon,
Right click your sheet tab, view code and paste this in. Enter 1 in A1 hides the rows anything else makes them visible, Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.Count 1 Then Exit Sub If Target.Address = "$A$1" Then Application.EnableEvents = False If Target.Value = 1 Then Rows("8:19").EntireRow.Hidden = True Else Rows("8:19").EntireRow.Hidden = False End If Application.EnableEvents = True End If End Sub Mike "Gordon" wrote: Hi... If I enter 1 into cell A1 I want to automatically hide rows 8-19. Is this possible? Cheers G |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi...
The value 1 fires in cell a1 and nothing happens. I should add that the 1 is derived from a formula, does that make a difference. This is the code currently in the sheet properties. Might something clash? Private Sub Worksheet_Activate() ActiveSheet.ScrollArea = "$a$1:$s$30" End Sub Private Sub Worksheet_Calculate() Dim sh As Worksheet SheetArray = Array("R", "A", "B", "Ba", "Rs", "Co", _ "Bf", "Bs", "Pa", "Pt", "Pa", "Ea", "Bar", "Ds", "Sp", "df") Set sh = Worksheets("SETUP") For sht = LBound(SheetArray) To UBound(SheetArray) With Sheets(SheetArray(sht)) If sh.Range("R4").Value = 0 Then .Visible = xlSheetHidden ElseIf sh.Range("R4").Value = 1 Then .Visible = xlSheetVisible End If End With Next End Sub Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.Count 1 Then Exit Sub If Target.Address = "$A$1" Then Application.EnableEvents = False If Target.Value = 0 Then Rows("1:19").EntireRow.Hidden = True Else Rows("1:19").EntireRow.Hidden = False End If Application.EnableEvents = True End If End Sub "Mike H" wrote: Gordon, Right click your sheet tab, view code and paste this in. Enter 1 in A1 hides the rows anything else makes them visible, Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.Count 1 Then Exit Sub If Target.Address = "$A$1" Then Application.EnableEvents = False If Target.Value = 1 Then Rows("8:19").EntireRow.Hidden = True Else Rows("8:19").EntireRow.Hidden = False End If Application.EnableEvents = True End If End Sub Mike "Gordon" wrote: Hi... If I enter 1 into cell A1 I want to automatically hide rows 8-19. Is this possible? Cheers G |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Hide Rows Based on Cell Result | Excel Programming | |||
hide rows based on cell value | New Users to Excel | |||
hide rows based on value in cell | Excel Discussion (Misc queries) | |||
Macro to hide rows based on a zero value in a particular cell | Excel Programming | |||
How to Hide Rows based on conditional value in cell | Excel Programming |