Hi Everyone,
Apologies, i'm very new to VBA so sorry if anything i'm saying doesn't make sense. I feel like i am part way there with my issue but struggling getting the second part working.
I have 2 drop down boxes
B1 with 2 options - "Pragmatic" or "Full Review"- the idea being if the "Pragmatic" option is selected then specified rows will be hidden - when Full review is selected every row should be unhidden. I have gotten this working how i need using the formula pasted below (for some reason i couldn't get commas inbetween each row working so i've added individual lines)
however my issue is I have a second drop down box in cell B2. which is a "Yes" or "No" option added - If "No" is selected then i want columns C : E to be hidden - If Yes then they can be kept unhidden.
the 2 aren't particularly dependant on each other and i'm really struggling how to get the second "If" function working - i.e If B1 drop down is Pragmatic how do i then also get the columns hidden when B2 is "No"
I feel like i need to "Nest"? 2 If functions with each other - and i quite frankly haven't got a clue - i've tried adding "If Range ("B1") = "Pragmatic" And If Range ("B2")="No" with a column line added but i can't quite seem to get there.
I've also attached an image of my spreadsheet (apologies but i've had to clear out some of the contents) but hopefully this gives the idea of what im looking for - in this instance i've got the rows hidden but i now want to be able to select the drop down in b2 as no mean that columns C to E will be hidden.
If anyone can help it will be greatly appreciated
excel 1.jpgPHP Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("B1") = "Pragmatic" Then
Rows("3").EntireRow.Hidden = True
Rows("4").EntireRow.Hidden = True
Rows("5").EntireRow.Hidden = True
Rows("7").EntireRow.Hidden = True
Rows("8").EntireRow.Hidden = True
Rows("9").EntireRow.Hidden = True
Rows("10").EntireRow.Hidden = True
Rows("17").EntireRow.Hidden = True
Rows("18").EntireRow.Hidden = True
Rows("19").EntireRow.Hidden = True
Rows("20").EntireRow.Hidden = True
Rows("21").EntireRow.Hidden = True
Rows("23").EntireRow.Hidden = True
Rows("28").EntireRow.Hidden = True
Rows("29").EntireRow.Hidden = True
Rows("30").EntireRow.Hidden = True
Rows("31").EntireRow.Hidden = True
Rows("32").EntireRow.Hidden = True
Rows("43").EntireRow.Hidden = True
Rows("44").EntireRow.Hidden = True
Rows("48").EntireRow.Hidden = True
Rows("50").EntireRow.Hidden = True
Rows("51").EntireRow.Hidden = True
Rows("53").EntireRow.Hidden = True
Rows("62").EntireRow.Hidden = True
Else
Rows("3").EntireRow.Hidden = False
Rows("4").EntireRow.Hidden = False
Rows("5").EntireRow.Hidden = False
Rows("7").EntireRow.Hidden = Fales
Rows("8").EntireRow.Hidden = False
Rows("9").EntireRow.Hidden = False
Rows("10").EntireRow.Hidden = False
Rows("17").EntireRow.Hidden = False
Rows("18").EntireRow.Hidden = False
Rows("19").EntireRow.Hidden = False
Rows("20").EntireRow.Hidden = False
Rows("21").EntireRow.Hidden = False
Rows("23").EntireRow.Hidden = False
Rows("28").EntireRow.Hidden = False
Rows("29").EntireRow.Hidden = False
Rows("30").EntireRow.Hidden = False
Rows("31").EntireRow.Hidden = False
Rows("32").EntireRow.Hidden = False
Rows("43").EntireRow.Hidden = False
Rows("44").EntireRow.Hidden = False
Rows("48").EntireRow.Hidden = False
Rows("50").EntireRow.Hidden = False
Rows("51").EntireRow.Hidden = False
Rows("53").EntireRow.Hidden = False
Rows("62").EntireRow.Hidden = False
End If
End Sub
Bookmarks