Validation List

M

marc747

Hi,
I have a Validation list in excel with two options to select "Option
1" & "Option 2" is it possible when selecting "Option 2" excel will
Automatically hide "Column F" and "Column M" and when "Option 1" is
selected it will unhide the same two Columns.

Thanks,

Marc
 
R

Rick Rothstein

Right click the tab at the bottom of the worksheet you want to have this
functionality, select View Code from the popup menu that appears and then
Copy/Paste this code into the code window that appeared...

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1:C3")) Is Nothing Then
Range("F:F,M:M").EntireColumn.Hidden = Target.Value = "Option 1"
End If
End Sub

Change the Range statement's cell range to the addresses of the cells that
have your Validation list in them.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top