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 |
All times are GMT +1. The time now is 07:56 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com