Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11
Default Hide columns if specific cell is blank?

I found a Macro, but I am having trouble modifying it to auto-hide the
column if a certain cell is empty. ie. I have blank columns that
serve as spaces between the next grouping of data and its hiding
everything. Basically, I want to say hide if a certain cell has a 0
(zero) in it. Any ideas?


Option Explicit
Sub hideCols()


Dim iCol As Long


With ActiveSheet
For iCol = 1 To .Cells(1, .Columns.Count).End(xlToLeft).Column
If Application.CountA( _
.Cells(2, iCol).Resize(.Rows.Count - 1)) = 0 Then
.Columns(iCol).Hidden = True
Else
.Columns(iCol).Hidden = False
End If
Next iCol
End With
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
Hide blank cells in either of 2 columns Brian Excel Discussion (Misc queries) 3 March 12th 07 05:45 PM
Macro to hide the row if both columns E & F are blank in that row. PCakes Excel Worksheet Functions 2 January 4th 07 10:07 PM
Hide a specific number in a cell Rhondarp Excel Discussion (Misc queries) 6 May 26th 06 08:24 PM
Hide all rows where one specific cell in that row = 0? jaydevil Excel Discussion (Misc queries) 2 August 26th 05 02:48 PM
Hide columns & rows that contain "0" or blank in a range of cells lw new guest Excel Worksheet Functions 0 August 18th 05 04:27 PM


All times are GMT +1. The time now is 10:32 PM.

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

About Us

"It's about Microsoft Excel"