Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Hide blank cells in either of 2 columns | Excel Discussion (Misc queries) | |||
Macro to hide the row if both columns E & F are blank in that row. | Excel Worksheet Functions | |||
Hide a specific number in a cell | Excel Discussion (Misc queries) | |||
Hide all rows where one specific cell in that row = 0? | Excel Discussion (Misc queries) | |||
Hide columns & rows that contain "0" or blank in a range of cells | Excel Worksheet Functions |