Rejje
12-01-2010, 11:18 AM
Hi!
Can someone please tell me why this hides column "C" in the worksheet that the address in area "HIDE_COLUMNS" points to. It does hide/unhide the columns as intended but also column "C"!
HOW IS THIS POSSIBLE?
V_40100 below:
FALSE
area
"HIDE_COLUMNS"
below:
HIDE_COLUMN_1010 =worksheet "KP", cell V3
HIDE_COLUMN_1020 =worksheet "KP", cell W3
HIDE_COLUMN_1030 =worksheet "KP", cell Y3
HIDE_COLUMN_1040 =worksheet "KP", cell AA3
HIDE_COLUMN_1050 =worksheet "KP", cell AB3
HIDE_COLUMN_1060 =worksheet "KP", cell AC3
HIDE_COLUMN_1070 =worksheet "KP", cell AD3
HIDE_COLUMN_1080 =worksheet "KP", cell AE3
HIDE_COLUMN_1090 =worksheet "KP", cell AF3
Sub HideColumns()
If Range("V_40100") = False Then
For Each cell In Range("HIDE_COLUMNS")
Range(cell.Value).EntireColumn.Hidden = True
Next cell
Else
For Each cell In Range("HIDE_COLUMNS")
Range(cell.Value).EntireColumn.Hidden = False
Next cell
End If
End Sub
Can someone please tell me why this hides column "C" in the worksheet that the address in area "HIDE_COLUMNS" points to. It does hide/unhide the columns as intended but also column "C"!
HOW IS THIS POSSIBLE?
V_40100 below:
FALSE
area
"HIDE_COLUMNS"
below:
HIDE_COLUMN_1010 =worksheet "KP", cell V3
HIDE_COLUMN_1020 =worksheet "KP", cell W3
HIDE_COLUMN_1030 =worksheet "KP", cell Y3
HIDE_COLUMN_1040 =worksheet "KP", cell AA3
HIDE_COLUMN_1050 =worksheet "KP", cell AB3
HIDE_COLUMN_1060 =worksheet "KP", cell AC3
HIDE_COLUMN_1070 =worksheet "KP", cell AD3
HIDE_COLUMN_1080 =worksheet "KP", cell AE3
HIDE_COLUMN_1090 =worksheet "KP", cell AF3
Sub HideColumns()
If Range("V_40100") = False Then
For Each cell In Range("HIDE_COLUMNS")
Range(cell.Value).EntireColumn.Hidden = True
Next cell
Else
For Each cell In Range("HIDE_COLUMNS")
Range(cell.Value).EntireColumn.Hidden = False
Next cell
End If
End Sub