View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Hiding columns based on row 4 criteria

Hi,

Right click the sheet tab, view code and paste this in and run it. Changing
True to false unhides

Sub mariner()
Set myrange = Range("W4:HE4")
For Each c In myrange
If Not IsEmpty(c) And c.Value = 0 Then
c.EntireColumn.Hidden = True
End If
Next
End Sub

Mike

"Pierre" wrote:

Looking for a macro to hide any columns from columns "W" through "HE"
if the cell in that column in row 4 is equal to zero (a formula exists
in the row 4 cell.)

Also, I surmise, if the macro includes the word "true", I can change
that to "false", and get a macro to open all the closed columns?

Thanks for any suggestions.

Pierre