Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
This is the code at present
Sub HideRows1() Dim Rng As Range Set Rng = Sheets("input-assumptions").Range("E88") If Rng.Value = "Yes" Then Rows("89:89").EntireRow.Hidden = False Range("E89").Select ElseIf Rng.Value = "No" Then Rows("89:122").EntireRow.Hidden = True Range("E88").Select End If End Sub Sub HideRows2() Dim Rng As Range Set Rng = Sheets("input-assumptions").Range("E89") If Rng.Value = "Yes" Then Rows("90:122").EntireRow.Hidden = False Range("E89").Select ElseIf Rng.Value = "No" Then Rows("90:121").EntireRow.Hidden = True Range("E89").Select End If End Sub Private Sub Worksheet_Change(ByVal Target As Range) If Target.Row < 88 Then Exit Sub If Target.Column < 5 Then Exit Sub HideRows1 If Target.Row < 89 Then Exit Sub If Target.Column < 5 Then Exit Sub HideRows2 End Sub however to run the HideRows2 macro i need to run the macro from the tools macro - tab of the excel, while the HideRows1 macro runs on automatically on slection of Yes or No Please help me |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Please change the code to the following
Sub HideRows1() Dim Rng As Range Set Rng = Sheets("input-assumptions").Range("E88") If Rng.Value = "Yes" Then Rows("89:89").EntireRow.Hidden = False Range("E89").Select ElseIf Rng.Value = "No" Then Rows("89:122").EntireRow.Hidden = True Range("E88").Select End If End Sub Sub HideRows2() Dim Rng As Range Set Rng = Sheets("input-assumptions").Range("E89") If Rng.Value = "Yes" Then Rows("90:122").EntireRow.Hidden = False Range("E89").Select ElseIf Rng.Value = "No" Then Rows("90:121").EntireRow.Hidden = True Range("E89").Select End If End Sub Private Sub Worksheet_Change(ByVal Target As Range) If Target.Row < 88 Then If Target.Row < 89 Then Exit Sub ElseIf Target.Column < 5 Then Exit Sub End If HideRows2 ElseIf Target.Column < 5 Then Exit Sub End If HideRows1 End Sub daidipya wrote: This is the code at present Sub HideRows1() Dim Rng As Range Set Rng = Sheets("input-assumptions").Range("E88") If Rng.Value = "Yes" Then Rows("89:89").EntireRow.Hidden = False Range("E89").Select ElseIf Rng.Value = "No" Then Rows("89:122").EntireRow.Hidden = True Range("E88").Select End If End Sub Sub HideRows2() Dim Rng As Range Set Rng = Sheets("input-assumptions").Range("E89") If Rng.Value = "Yes" Then Rows("90:122").EntireRow.Hidden = False Range("E89").Select ElseIf Rng.Value = "No" Then Rows("90:121").EntireRow.Hidden = True Range("E89").Select End If End Sub Private Sub Worksheet_Change(ByVal Target As Range) If Target.Row < 88 Then Exit Sub If Target.Column < 5 Then Exit Sub HideRows1 If Target.Row < 89 Then Exit Sub If Target.Column < 5 Then Exit Sub HideRows2 End Sub however to run the HideRows2 macro i need to run the macro from the tools macro - tab of the excel, while the HideRows1 macro runs on automatically on slection of Yes or No Please help me |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Hide Macro's in Toolbar / Macro's list | Excel Discussion (Misc queries) | |||
Tracking Errors | Excel Worksheet Functions | |||
how do I run excel 4.0 macros on excel 2000 | Excel Discussion (Misc queries) | |||
Excel crashes while opening excel file imbeddied with macros | Excel Discussion (Misc queries) | |||
macros errors | Excel Worksheet Functions |