Hiding Columns produces error <----HELP PLEASE

D

Dan

Hello -

Below is a snipit of code I have for hding columns. I am getting the
Runtime Error "Unable to set the Hidden Property of the Range Class".
I'm using Excel 2007 and wonder if there is a limit to the amount of
columns I can hide in VBA.

Else
Columns("S:AW").Hidden = True
Columns("AX:AX").Hidden = False
Columns("AY:ZZ").Hidden = True
Columns("AAA:WWW").Hidden = True
Columns("WWX:XAA").Hidden = True
Columns("XAB:XDD").Hidden = True
Columns("XDE:XFD").Hidden = True

I basically want to hide columns AY:XFD, but can't seem to make it
work in one line of code. I appreciate any advice.

Thanks!
 
G

GS

Dan presented the following explanation :
Hello -

Below is a snipit of code I have for hding columns. I am getting the
Runtime Error "Unable to set the Hidden Property of the Range Class".
I'm using Excel 2007 and wonder if there is a limit to the amount of
columns I can hide in VBA.

Else
Columns("S:AW").Hidden = True
Columns("AX:AX").Hidden = False
Columns("AY:ZZ").Hidden = True
Columns("AAA:WWW").Hidden = True
Columns("WWX:XAA").Hidden = True
Columns("XAB:XDD").Hidden = True
Columns("XDE:XFD").Hidden = True

I basically want to hide columns AY:XFD, but can't seem to make it
work in one line of code. I appreciate any advice.

Thanks!

Try...

Columns("S:XFD") = True: Columns("AX").Hidden = False
 

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