Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I want to hide or show 3 columns depending on the
selection made from a drop-down data validation list. I can only get the column that was selected prior to making a different selection from the list to hide. I don't understand why the columns specified in the code won't hide, so any help I can get with this will be great. Also, this is a worksheet change event; I'm not sure if that's the best way to go with this. Here's the code I've been using; try not to laugh too hard: Sub Worksheet_Change(ByVal Target As Excel.Range) If Application.Intersect(Target, Range("Plan Costs!e1")) = "Hi-Low" Then Exit Sub End If If Application.Intersect(Target, Range("Plan Costs!e1")) = "EDLC" Then Sheets("Period 1").Select Columns("M:O").Select Selection.EntireColumn.Hidden = True End If End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub Worksheet_Change(ByVal Target As Excel.Range)
If Application.Intersect(Target, Range("Plan Costs!e1")) = "Hi-Low" Then Exit Sub End If If Application.Intersect(Target, Range("Plan Costs!e1")) = "EDLC" Then Sheets("Period 1").Columns("M:O"). _ .EntireColumn.Hidden = True End If End Sub -- Regards, Tom Ogilvy "Eva Shanley" wrote in message ... I want to hide or show 3 columns depending on the selection made from a drop-down data validation list. I can only get the column that was selected prior to making a different selection from the list to hide. I don't understand why the columns specified in the code won't hide, so any help I can get with this will be great. Also, this is a worksheet change event; I'm not sure if that's the best way to go with this. Here's the code I've been using; try not to laugh too hard: Sub Worksheet_Change(ByVal Target As Excel.Range) If Application.Intersect(Target, Range("Plan Costs!e1")) = "Hi-Low" Then Exit Sub End If If Application.Intersect(Target, Range("Plan Costs!e1")) = "EDLC" Then Sheets("Period 1").Select Columns("M:O").Select Selection.EntireColumn.Hidden = True End If End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tom, thanks for the reply, but it's still not working for
me. I'm getting "Method range of object_worksheet failed" error. Help???? -----Original Message----- Sub Worksheet_Change(ByVal Target As Excel.Range) If Application.Intersect(Target, Range("Plan Costs!e1")) = "Hi-Low" Then Exit Sub End If If Application.Intersect(Target, Range("Plan Costs!e1")) = "EDLC" Then Sheets("Period 1").Columns("M:O"). _ .EntireColumn.Hidden = True End If End Sub -- Regards, Tom Ogilvy "Eva Shanley" wrote in message ... I want to hide or show 3 columns depending on the selection made from a drop-down data validation list. I can only get the column that was selected prior to making a different selection from the list to hide. I don't understand why the columns specified in the code won't hide, so any help I can get with this will be great. Also, this is a worksheet change event; I'm not sure if that's the best way to go with this. Here's the code I've been using; try not to laugh too hard: Sub Worksheet_Change(ByVal Target As Excel.Range) If Application.Intersect(Target, Range("Plan Costs!e1")) = "Hi-Low" Then Exit Sub End If If Application.Intersect(Target, Range("Plan Costs!e1")) = "EDLC" Then Sheets("Period 1").Select Columns("M:O").Select Selection.EntireColumn.Hidden = True End If End Sub . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Want to Hide columns in spreadsheet but NOT hide data in chart. | Charts and Charting in Excel | |||
Chart Values that change based on Change event | Excel Programming | |||
Excel VBA-hide row worksheet event | Excel Programming | |||
change event/after update event?? | Excel Programming | |||
Pivot Table NewSheet Event Hide Columns | Excel Programming |