Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 193
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
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

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 193
Default 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



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default 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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Count based on criteria from two different columns ba374 Excel Discussion (Misc queries) 2 November 13th 07 04:41 PM
Hiding rows based on a criteria thru and event proceedure realmani Excel Worksheet Functions 2 September 7th 07 10:35 AM
Need to count based on different criteria in two columns Adlin Excel Worksheet Functions 3 May 25th 07 08:05 PM
Sum based on criteria in rows and columns EstherJ Excel Discussion (Misc queries) 1 November 1st 05 10:28 AM
Hiding columns based on user/password jmatchus Excel Worksheet Functions 0 January 17th 05 06:49 PM


All times are GMT +1. The time now is 06:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"