![]() |
Hiding columns based on row 4 criteria
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 |
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 |
Hiding columns based on row 4 criteria
On May 30, 2:08*pm, Mike H wrote:
Mike, worked like a charm. Thanks so much! Pierre 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 |
Hiding columns based on row 4 criteria
Your welcome
"Pierre" wrote: On May 30, 2:08 pm, Mike H wrote: Mike, worked like a charm. Thanks so much! Pierre 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 |
All times are GMT +1. The time now is 10:49 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com