Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Hide Columns w/Change Event

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Hide Columns w/Change Event

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Hide Columns w/Change Event

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Want to Hide columns in spreadsheet but NOT hide data in chart. KrispyData Charts and Charting in Excel 1 March 20th 09 04:45 PM
Chart Values that change based on Change event ExcelMonkey[_119_] Excel Programming 1 May 15th 04 03:43 AM
Excel VBA-hide row worksheet event kabrahani Excel Programming 2 April 3rd 04 06:18 PM
change event/after update event?? scrabtree23[_2_] Excel Programming 1 October 20th 03 07:09 PM
Pivot Table NewSheet Event Hide Columns Tysone Excel Programming 2 October 15th 03 01:51 AM


All times are GMT +1. The time now is 05:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"