View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Karen McKenzie Karen McKenzie is offline
external usenet poster
 
Posts: 41
Default Hiding/Unhiding Columns

Thanks Bob,

Can I get this to run automatically when the value in cell D1 changes?

"Bob Phillips" wrote:


Dim cell As Range

On Error Resume Next
For Each cell In Rows(6).Cells
cell.EntireColumn.Hidden = cell.Value Range("D1").Value
Next cell


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Karen McKenzie" wrote in message
...
My spreadsheet has numerous sections all with period numbers 1-12 showing

in
columns on line 6. Line 6 also contains some blank cells and text cells.
Cell D1 contains the current period number.
I want to be able to hide any columns where the number in line 6 is

greater
than the value in cell D1
ie if D1 is 4, then any columns in the spreadsheet that contain a number
greater than 4 in line 6 would be hidden.

Can anyone help please.