Hello,
Thanks for your time. I am currently trying to write a VBA that will hide a RANGE of cells based on the value of a drop down list. I.E., my dropdown list is in C18 and contains a list of 0-6 (number of dents). So, if the user selects say 2 dents, I want to hide cells A28:C43 (dent dimensions-an entire block of cells). I have a VBA written, but as of right now it is hiding the entire column, and I haven't figure out how to edit it for a range of cells and not just the column. Here is my code
Private Sub ComboBox1_Change()
If Range("C18").Value = "0" Then
Range("C19:C43").EntireColumn.Hidden = True
ElseIf Range("C18").Value = "1" Then
Range("C19:C23").EntireColumn.Hidden = False
Range("C23:C43").EntireColumn.Hidden = True
ElseIf Range("C18").Value = "2" Then
Range("C19:C27").EntireColumn.Hidden = False
Range("C28:C43").EntireColumn.Hidden = True
ElseIf Range("C18").Value = "3" Then
Range("C19:C31").EntireColumn.Hidden = False
Range("C32:C43").EntireColumn.Hidden = True
ElseIf Range("C18").Value = "4" Then
Range("C19:C35").EntireColumn.Hidden = False
Range("C36:C43").EntireColumn.Hidden = True
ElseIf Range("C18").Value = "5" Then
Range("C19:C39").EntireColumn.Hidden = False
Range("C40:C43").EntireColumn.Hidden = True
ElseIf Range("C18").Value = "6" Then
Range("C19:C43").EntireColumn.Hidden = False
End If
End Sub
If this is not enough information required, please let me know.
Any help will be much appreciated. Thanks!
---------- Post added at 10:47 AM ---------- Previous post was at 09:58 AM ----------
Is this even possible? When using Format>Visibility>Hide and Unhide, there is not option for hiding cells I know, but I'm hoping there's a way to put bounds on entirecolumn.hidden/entirerow.hidden.
Thanks again.
Bookmarks