View Single Post
  #5   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

If desired, send your file to my address below along with this msg and
a clear explanation of what you want and before/after examples.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Tami" wrote in message
...
works like a charm....forgot to ask, if i protec the worksheet because i
have
a lot of users, will it still work?

what about hiding rows base on a value in column c....for example i'll use
column A to indicate "S" if i want to print all the spring styles, "U" for
all the summers syles but if i put "B" i want that row to appear on both
reports...

"Don Guillett" wrote:

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