PDA

View Full Version : Solved: Unwanted hiding of a column



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

Rejje
12-01-2010, 11:21 AM
Apperently it's not possible to paste a block of cells...

Rejje
12-01-2010, 11:21 AM
One more thing: I would like for it to run all the time. Whrer do I place it then? Do I need to rename it like "Private sub" or something else?

Rejje
12-01-2010, 11:44 AM
Sorry - was my noobness. Another macro was the culprit...