Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]() Hi, I thought you were using a listbox from the Control Toolbox menu. Anyway, since you are using the Data Validation, you need to use the following code. Assuming that the data validation is for the cell A1, use Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$A$1" Then Worksheets("Trial").Columns("A:AD").EntireColumn.H idden = False If Target.Value = "Alpha" Then Worksheets("Trial").Columns("K:K").EntireColumn.Hi dden = True Worksheets("Trial").Columns("X:AD").EntireColumn.H idden = True ElseIf Target.Value = "Beta" Then Worksheets("Trial").Columns("D:D").EntireColumn.Hi dden = True Worksheets("Trial").Columns("K:L").EntireColumn.Hi dden = True ElseIf Target.Value = "Alpha Infinite Depth" Then Worksheets("Trial").Columns("X:AD").EntireColumn.H idden = True ElseIf Target.Value = "Beta Infinite Depth" Then Worksheets("Trial").Columns("D:D").EntireColumn.Hi dden = True Worksheets("Trial").Columns("L:L").EntireColumn.Hi dden = True End If End If End Sub This code should go in the module of the sheet where you will select the value alpha or beta.... Also change $A$1 from the code above to suit your needs. Mangesh -- mangesh_yadav ------------------------------------------------------------------------ mangesh_yadav's Profile: http://www.excelforum.com/member.php...o&userid=10470 View this thread: http://www.excelforum.com/showthread...hreadid=379611 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Auto Hide Columns | Excel Discussion (Misc queries) | |||
I used the "hide" feature on 3 columns - now I cannot get them b. | New Users to Excel | |||
How do I automatically hide columns in a worksheet based on a cell value? | Excel Worksheet Functions | |||
Hide Cell Content if no data in previous columns | Excel Discussion (Misc queries) | |||
drop down list multiple columns | Excel Discussion (Misc queries) |