View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Hide Columns based on a cell value

Just delete the part about selection and restrict to cell L1

Private Sub Worksheet_change(ByVal Target As Range)
if target.address < Range("L1").address then exit sub
if ucase(target) = "N" Then
Columns("A:H").Hidden = True
Else
Columns("A:H").Hidden = False
End If
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Tami" wrote in message
...
I have a spreadsheet that i want to hide columns a:H if the value in cell
L1="N" and unhide if theres a "Y". i'd prefer for the "macro" to be
real-time based on when then N or Y changes.
i got this code off the internet but it doesn't work consistently...i
should
have know better than to deviate from this faithful website:-)

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("L1").Value = "N" Then
Columns("A:H").EntireColumn.Hidden = True
Else
Columns("A:H").EntireColumn.Hidden = False
End If
End Sub

anyone?.....