Hiding/Unhiding Columns

M

Mike

Good Morning All,
Using Excel XP.

I have a spreadsheet that has columns A to AJ which has F, X, Y, Z that are
hidden. I have a macro that unhides columns A to AJ and brings me down to
the first blank row in column A. After entering data I want to run a macro
that hides columns F, X. Y, Z again.
The macro that I made up hides X,Y,Z but leaves me at column K (not A) to
AJ. Somehow it hides A to J, which I don't want to do.

Thank you in advance for any help in this situation,

Michael
 
D

Don Guillett

try this to toggle hidden/unhidden.

Sub togglecol()
Range("f1,x1:z1").EntireColumn.Hidden = Not
Range("f1,x1:z1").EntireColumn.Hidden
End Sub
 
D

Don Guillett

Needs to be ONE line or use the continuation _
Sub togglecol()
Range("f1,x1:z1").EntireColumn.Hidden = _
Not Range("f1,x1:z1").EntireColumn.Hidden
End Sub
 
M

Mike

Thanks Don, that works.
What I forgot to post is that once after I enter data in the last blank
cell in Column A, I want to hide the first blank row and subsequent rows to
row 34 in the spreadsheet.
So the columns will always be the same ones to hide, F, X, Y and Z but the
rows will always change based on the last blank row to row 34. I was
wondering how that code be written.
Thank you,

Michael
 

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