Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unhiding rows
Hi,
I am very, very new to macros so please forgive me. I am trying to unhide rows when the word "Yes" is selected in a cell. I have found (and modified the following macro) from another post, which works great: Private Sub Worksheet_Change(ByVal Target As Range) If Range("c14").Text = "Yes" Then Rows("15:16").EntireRow.Hidden = False If Range("c14").Text = "" Then Rows("15:16").EntireRow.Hidden = True End Sub My problem is, I need this to work for the following as well: if c17 is yes, unhide 18:19 if c20 is yes, unhide 21:22 if c23 is yes, unhide 24:25 I tried copying and pasting the first macro and modifying it for each scenario but I get an error message (something about the Private Sub). Any help would be greatly appreciated! :) |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unhiding rows
Wow! That works perfectly!!! Thank you SO much!!!!!! :)
"Don Guillett" wrote: Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("c14,c17,c20,c23")) _ Is Nothing Then Exit Sub If UCase(Target) = "YES" Then Target.Offset(1).Resize(2).EntireRow.Hidden = False Else Target.Offset(1).Resize(2).EntireRow.Hidden = True End If End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "ashlie" wrote in message ... Hi, I am very, very new to macros so please forgive me. I am trying to unhide rows when the word "Yes" is selected in a cell. I have found (and modified the following macro) from another post, which works great: Private Sub Worksheet_Change(ByVal Target As Range) If Range("c14").Text = "Yes" Then Rows("15:16").EntireRow.Hidden = False If Range("c14").Text = "" Then Rows("15:16").EntireRow.Hidden = True End Sub My problem is, I need this to work for the following as well: if c17 is yes, unhide 18:19 if c20 is yes, unhide 21:22 if c23 is yes, unhide 24:25 I tried copying and pasting the first macro and modifying it for each scenario but I get an error message (something about the Private Sub). Any help would be greatly appreciated! :) |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unhiding rows
Glad to help
-- Don Guillett Microsoft MVP Excel SalesAid Software "ashlie" wrote in message ... Wow! That works perfectly!!! Thank you SO much!!!!!! :) "Don Guillett" wrote: Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("c14,c17,c20,c23")) _ Is Nothing Then Exit Sub If UCase(Target) = "YES" Then Target.Offset(1).Resize(2).EntireRow.Hidden = False Else Target.Offset(1).Resize(2).EntireRow.Hidden = True End If End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "ashlie" wrote in message ... Hi, I am very, very new to macros so please forgive me. I am trying to unhide rows when the word "Yes" is selected in a cell. I have found (and modified the following macro) from another post, which works great: Private Sub Worksheet_Change(ByVal Target As Range) If Range("c14").Text = "Yes" Then Rows("15:16").EntireRow.Hidden = False If Range("c14").Text = "" Then Rows("15:16").EntireRow.Hidden = True End Sub My problem is, I need this to work for the following as well: if c17 is yes, unhide 18:19 if c20 is yes, unhide 21:22 if c23 is yes, unhide 24:25 I tried copying and pasting the first macro and modifying it for each scenario but I get an error message (something about the Private Sub). Any help would be greatly appreciated! :) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
hiding/unhiding rows | Excel Worksheet Functions | |||
Unhiding Rows | Excel Discussion (Misc queries) | |||
Unhiding rows | Excel Discussion (Misc queries) | |||
hidden rows keep unhiding themselves! | Excel Discussion (Misc queries) | |||
Unhiding Rows | Excel Programming |