new macro to format worksheet

M

mclovin

I'm trying to record a new macro to hide specific columns & rows. I went to
"record new macro" and went through the steps, but when I try to test out the
macro I recorded, it ends up hiding more columns than I wanted. For
instance, I want to hide H:I, K:M, S:AE & AG:AH, but when I play the macro it
ends up hiding F:BC. How do I fix that?
 
L

Luke M

It may depend on how you recorded it, what order you selected things, etc.

Correction:
Open the VBA (Alt+F11), open the module you're macro is reocrded in.
whatever part is there dealing with hiding the columns can be deleted and
replaced with this single line:

Range("H:I,K:M,S:AE,AG:AH").EntireColumn.Hidden = True

Of note, rows can be done with something like
Range("5:6,10:11")EntireRow.Hidden = True
 
M

mclovin

It didn't work. Perhaps I deleted too much??
So in my module, it says:

Range("H:I,K:M,S:AE,AG:AH").EntireColumn.Hidden = True

End Sub
 

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