ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Conditionally showing hidden columns in XL 2000 (https://www.excelbanter.com/excel-programming/377299-conditionally-showing-hidden-columns-xl-2000-a.html)

Kermit Piper

Conditionally showing hidden columns in XL 2000
 
Hello, I have a sheet with many hidden columns. What I wanted to know,
is if I could conditionally show these hidden columns if their column
header cell is populated with a value. In other words, on a separate
data sheet are my values. Then, using one of those values, I'm
populating a value for the column header(s). So, all the other cells
underneath that column header cell would appear as one whole column,
but only if that column header cell has a value.

Here is a sample of my source table, which is populated with MS Query:

Test Program 1 8/5/2006 123452.01
Test Program 1 8/6/2006 123452.02
Test Program 1 8/8/2006 123452.03
Test Program 1 8/7/2006 123452.04

The last column is the value I'm using to populate the Column Header on
the display table:

520467.01 520467.02 520467.03 520467.03
Empty Cell Empty Cell Empty Cell Empty Cell

So, if I have 123452.05, then that hidden column would now become
visible. I have up to 99 hidden columns, because I know it will never
go beyond that number according to our business rules.

I think what I need to do is something like create a named range
containing the partial row that contained all the cells that I wanted
to use for selection criteria, in this case my column headings.

Then it is just a case of iterating through the cells in the named
range, comparing the values, and setting .EntireColumnHidden to either
True or False accordingly. Although I'm not sure this is the correct
approach. Could someone please show me an example of how I could code
this?

Thanks,
KP


Kermit Piper

Conditionally showing hidden columns in XL 2000
 
Thanks everyone for your overwhelming response. Thanks so much!



All times are GMT +1. The time now is 02:41 AM.

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