View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Tami Tami is offline
external usenet poster
 
Posts: 123
Default Hide Columns based on a cell value

possibly the macro does not work below because its case senstive...can i
enter a lower or uppercase "y"

"Tami" wrote:

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?.....