PDA

View Full Version : Solved: Hiding and unhiding rows



K. Georgiadis
10-25-2007, 04:55 PM
I'm having a mental block with this; cell B22 in the named worksheet is linked to a combo box with two possible values: 1 or 2.

Can you see a syntax problem below that would prevent hiding and unhiding the named rows based on whether B22 returns 1 or 2?


Sub Starch_Yield()
If Worksheets(?Starch?).Range("B22").Value = "1" Then
Range(?27:36?).EntireRow.Hidden = False
Range(?70:114?).EntireRow.Hidden = True
Else
Range(?27:36?).EntireRow.Hidden = True
Range(?70:114?).EntireRow.Hidden = False
End If
End Sub


PS: Ignore this! I solved it but I cannot use the code because the ranges to be hidden/unhidden contain combo boxes of their own which get piled up on top of one another when the rows are hidden. I'll need to put the alternative set of data on a separate worksheet and hide one of the two worksheets depending on the selection made.