View Full Version : hidding a column based on an outcome to an if statement


dusty
08-20-2009, 04:47 AM
I need to know how to compare a collumn with a cell and hide the collum the cell is in if any of the cells from the collumn do not match the cell

for example IF collumn A( from A3 till end) does not = B2 hide collumn B

also can this be continuosly running so that if the collum changed hidden collums could be unhiden and new ones hidden?

Cheers Dusty

HaHoBe
08-20-2009, 06:26 AM
Hi, Dusty,

I do have some problems understanding what you are after. Maybe the VBA Code

Range("B2").EntireColumn.Hidden = (WorksheetFunction.CountIf(Range("A3:A" & Rows.Count), Range("B2")) > 0)
may give you a hint where to go (if a column is hidden you canīt use the column itself for any start of a procedure or an event, so I think the Worksheet_Change event wonīt be of much use here).

Ciao,
Holger

dusty
08-21-2009, 12:33 AM
thanks for the reply