View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Hide columns based on row values

Hi Brendan,

Am Fri, 7 Mar 2014 12:40:29 -0800 (PST) schrieb :

"if A5 = "PRINT", then do not hide column A. If A5 = "" (blank/empty cell - other than the formula that in that cell) then hide column A. I want it then to do that same for columns B through VF so that the columns for each cell that returns "PRINT" will not be hidden and the columns for each cell that return "" will be hidden.


try:

Sub HideCols()
Dim rngC As Range

Application.ScreenUpdating = False
For Each rngC In Range("A5:VF5")
rngC.EntireColumn.Hidden = (rngC < "PRINT")
Next
Application.ScreenUpdating = True
End Sub


Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2