LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default How do I hide certain columns in a sheet with merged cells in a row using a macro?

I'm having trouble with a macro that is meant to hide selected columns in a
worksheet (see below). Not only does it hide the columns I want hidden, but
it also hides all columns between and to the left of the selected range.
Testing on a blank sheet I've verified that the problem appears to be that I
have title rows in the sheet, which use merged cells in a row, basically
covering the whole range of columns the macro operates on, so that for
example A7:AQ7 are merged into a single cell. Could anyone suggest a way
round it, please? I realize that I could include in the macro actions that
would unmerge the title cells before running the hide part of the macro,
then merge the title cells again, BUT the title cells are many and vary in
cell coverage, and it would require a great deal of selecting. I feel that
there must be a way round this, but I have very little VBA knowledge. All
suggestions and help VERY gratefully received and acknowledged.

Macro:-
_______
Sub Hide_2wk_Macro3()

Range( _
"C:C,D:D,F:F,G:G,I:I,J:J,L:L,M:M,O:O,P:P,R:R,S:S,U :U,V:V,Z:Z,AA:AA,AD:AD,AC:AC,AF:AF,AG:AG,AI:AI,AJ: AJ,AL:AL,AM:AM,AO:AO,AP:AP,AR:AR,AS:AS"
_
).Select
Range("AS1").Activate
Selection.EntireColumn.Hidden = True
Range("A5").Activate
End Sub
_________
TIA

Dan E
--
Dan E



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
sorting two columns of merged cells bigjim Excel Discussion (Misc queries) 2 April 3rd 10 09:05 PM
How to show columns/cells in sheet but hide them in print? Jeff Korn Excel Discussion (Misc queries) 8 May 25th 08 05:54 PM
If I have a work sheet protected and try to run a macro to hide rows or columns it won't work. Correct? Marc Excel Programming 2 July 12th 06 04:10 AM
Hide all columns that span a merged cell? Stuart Peters Excel Programming 8 April 4th 06 10:32 PM
Sort columns containing merged cells. Ron Excel Discussion (Misc queries) 1 May 4th 05 01:08 PM


All times are GMT +1. The time now is 06:46 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"