View Single Post
  #6   Report Post  
mangesh_yadav
 
Posts: n/a
Default


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