View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Macro not working in Excel 2002

Hi
do you get an error in Excel 2003 or what exactly dows not work?

--
Regards
Frank Kabel
Frankfurt, Germany

"cottage6" schrieb im Newsbeitrag
...
Does anyone know why the following code works fine in Excel 2000 but

not at
all in Excel 2002 SP3? I need to hide or show different columns

depending on
whether the selection made from a validation list in F1 is Hi-Low or

EDLC.
This file needs to be worked on by users with either version of

Excel.
Help?!! This is driving me nuts!

Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim ws As Worksheet
If Target.Address = "$F$1" And Target.Value = "Hi-Low" Then
For Each ws In Sheets(Array("Period 1"))
ws.Columns("M:O").EntireColumn.Hidden = False
Next ws
For Each ws In Sheets(Array("Period 2", "Period 3", "Period 4",

"Period
5", "Period 6", _
"Period 7", "Period 8", "Period 9", "Period 10", "Period 11",

"Period
12"))
ws.Columns("K:M").EntireColumn.Hidden = False
Next ws
Else
If Target.Address = "$F$1" And Target.Value = "EDLC" Then
For Each ws In Sheets(Array("Period 1"))
ws.Columns("M:O").EntireColumn.Hidden = True
Next ws
For Each ws In Sheets(Array("Period 2", "Period 3", "Period

4",
"Period 5", "Period 6", _
"Period 7", "Period 8", "Period 9", "Period 10", "Period 11",
"Period 12"))
ws.Columns("K:M").EntireColumn.Hidden = True
Next ws
End If
End If

End Sub