Hiding Columns with Merged Cells

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to include instructions in a macro to hide a column.
Part of the column contains merged cells.
When I record a macro for the process I want, the instructions read:

Columns("D:D").Select
Selection.EntireColumn.Hidden = True

However, when these instructions are incorporated into my macro both columns
D and E (due to the merged cells) are hidden.

Any help would be appreciated.
Thanks.
 
Unmerge the cells and then hide the column.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Steve Pollack" <[email protected]>
wrote in message
I would like to include instructions in a macro to hide a column.
Part of the column contains merged cells.
When I record a macro for the process I want, the instructions read:

Columns("D:D").Select
Selection.EntireColumn.Hidden = True

However, when these instructions are incorporated into my macro both columns
D and E (due to the merged cells) are hidden.

Any help would be appreciated.
Thanks.
 
It is the Select method that is causing you the problem.
Shorten the code by taking out the .Select and it will work fine -

Columns("D:D").EntireColumn.Hidden = True

Hope this helps

Mark
 
Mark,

I've taken your advice about the .Select but am still having problems.
Below is a snippet of my code. Please advise if there is anything I can do
to correct this.

Thanks!

Randy

Select Case ProjectSize
Case Is = "s"
Columns("G:H").EntireColumn.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

Back
Top