Maximum number of hidden columns

G

Guest

I have the following code whereby I am trying to hide 91 columns, but it
croakes on
the ---> line below
Columns("DI:DU").Hidden = True
Columns("DV:EH").Hidden = True
Columns("EI:EU").Hidden = True
---> Columns("EV:FH").Hidden = True
Columns("FI:FU").Hidden = True
Columns("FV:GH").Hidden = True
Columns("GI:GU").Hidden = True

The error is "Unable to set the hidden property of the Range class", error
1004.

Is there a maximum number of columns that can be hidden?
 
G

Guest

I have tried both of these...
Range("DI:GU").EntireColumn.Hidden = True
Range("DI:DU,DV:EH,EI:EU,EV:FH,FI:FU,FV:GH,GI:GU").EntireColumn.Hidden = True
Neither of them works.... same error.
 
D

Don Guillett

I just tested both of yours and got no error on either
send be your workbook if desired.
 
G

Guest

Don,

The Excel file is almost 9mb and has private and confidential banking data
so I can't send you the file.

Does it matter if the columns have data or not? In my case they all have
some data in some of the 960 rows.
 
D

Don Guillett

I wouldn't think it mattered. Without testing, maybe merged cells.??
I do confidential work for clients on a routine basis.
Ex series 7 license holder and regional mgr for ING.
 
G

Guest

My best guess would be that you are trying to hide columns with merged cells
(spanning columns) in them. You can not hide half of a merged cell... One
question though is why do you have so many ranges to hide when the ranges
form one large continuous block of columns? You could try...

Columns("DI:GU").Hidden = True
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top