Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
HI,
Could somebody please explain why this macro will not hide/unhide rows 57:59? The macro fires correctly, runs through the If statements correctly but does not hide/unhide the rows in the second range. The first range works perfectly. Private Sub Worksheet_Change(ByVal Target As Range) On Error Resume Next Select Case Target.Address 'First Range Case Range("C35").Address If Range("C35").Text = "YES" Then Rows("36:38").Hidden = False Else Rows("36:38").Hidden = True End If 'Second Range Case Range("C41").Address If Range("C41").Text = "4 Week Month" Then Rows("57:59").Hidden = False Else Rows("57:59").Hidden = True End If Case Else End Select End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Your code works correctly on my system. If I enter YES in C35 the Rows are
visible, If C35 is empty, the rows are not visible. Same thing with C41. 4 Week Month, visible - Empty, not visible. What were you expecting it to do? " wrote: HI, Could somebody please explain why this macro will not hide/unhide rows 57:59? The macro fires correctly, runs through the If statements correctly but does not hide/unhide the rows in the second range. The first range works perfectly. Private Sub Worksheet_Change(ByVal Target As Range) On Error Resume Next Select Case Target.Address 'First Range Case Range("C35").Address If Range("C35").Text = "YES" Then Rows("36:38").Hidden = False Else Rows("36:38").Hidden = True End If 'Second Range Case Range("C41").Address If Range("C41").Text = "4 Week Month" Then Rows("57:59").Hidden = False Else Rows("57:59").Hidden = True End If Case Else End Select End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe what's being entered in the cell isn't exactly the text in the
code? It's case-sensitive; "yes" or "Yes" won't make it work... even leading or trailing spaces won't. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Dec 12, 12:30 pm, ward376 wrote:
Maybe what's being entered in the cell isn't exactly the text in the code? It's case-sensitive; "yes" or "Yes" won't make it work... even leading or trailing spaces won't. To both the above, thanks for the resposes and yes, I was expecting the code to do exactly as it looks, hide and unhide the rows based on the cell values but for the life of me (and the other IT consultants sitting next to me) we cannot figure out why this does not work. The cell values are correct, they are selected from a cell validation drop down box and when stepping thru the macro, the correct commands are being called. It still doesn't work. There is (obviously) something else affecting the code, the cells, the whatever but I cannot find it! gavin |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is there data filtering on the sheet? Are the row heights set to 0?
Does it work for you if you try it in a new workbook? Just that macro, nothing else. It works for me. -- Tim Zych SF, CA wrote in message ... On Dec 12, 12:30 pm, ward376 wrote: Maybe what's being entered in the cell isn't exactly the text in the code? It's case-sensitive; "yes" or "Yes" won't make it work... even leading or trailing spaces won't. To both the above, thanks for the resposes and yes, I was expecting the code to do exactly as it looks, hide and unhide the rows based on the cell values but for the life of me (and the other IT consultants sitting next to me) we cannot figure out why this does not work. The cell values are correct, they are selected from a cell validation drop down box and when stepping thru the macro, the correct commands are being called. It still doesn't work. There is (obviously) something else affecting the code, the cells, the whatever but I cannot find it! gavin |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Color alternate rows when after hiding selected rows | Excel Worksheet Functions | |||
Hiding Specific Rows Based on Values in Other Rows | Excel Worksheet Functions | |||
Hiding a button when hiding rows | Excel Discussion (Misc queries) | |||
hiding Rows and buttons/comboxes, over the rows | Excel Programming | |||
Hiding Rows if the linked rows are blank | Excel Discussion (Misc queries) |