ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Conditional Column Hide (https://www.excelbanter.com/excel-programming/284055-conditional-column-hide.html)

firebird96

Conditional Column Hide
 

I want to hide each column that meets a certain condition. ie. I want to
hide column 'B' if B3 < Today() or I want to hide column 'C' if C3 <
Today(), an so on down the line. Yes, I want to hide each column where
the date in row 3 is less than todays date.

Kevin


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements

Tom Ogilvy

Conditional Column Hide
 
Dim cell as Range
for each cell in Range("A3:IV3")
if not isempty(cell) then
if isdate(cell.value) then
if cell.Value < Date then
cell.EntireColumn.Hidden = True
else
cell.EntireColumn.Hidden = false
end if
end if
end if
Next

or


for each cell in Range("A3:IV3")
if not isempty(cell) then
if isdate(cell.value) then
cell.EntireColumn.Hidden = cellValue < Date
end if
end if
Next

--
Regards,
Tom Ogilvy


"firebird96" wrote in message
...

I want to hide each column that meets a certain condition. ie. I want to
hide column 'B' if B3 < Today() or I want to hide column 'C' if C3 <
Today(), an so on down the line. Yes, I want to hide each column where
the date in row 3 is less than todays date.

Kevin


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to

creating financial statements




All times are GMT +1. The time now is 03:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com