Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Hiding a range of cells

Hi, I am trying to get a series of columns hidden but when I do this, it
selects the columns H to O as H1-O1 are merged together as a cell. I can't
seem to set the rngMulti.Hidden property either. Any help would be hot!!

Sub Test()
Dim rng1 As Range, rng2 As Range, rngMulti As Range
Worksheets("Sheet 1").Activate
Set rng1 = Range("H:I")
Set rng2 = Range("K:L")
Set rngMulti = Union(rng1 , rng2)
rngMulti.Select
End Sub

Thanks
Melvin


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Hiding a range of cells

Hi,
you wont get anywhere with this while your cells are merged. I think
most Excel developers agree that merged cells should really be avoided,
as most of the effects they produce can be acieved via other methods
(Centre across selection etc...). You certainly cannot hide a column
with a merged cell in it without hiding the other column(s) involved in
that merge as well...

If you do unmerge the cells then this should work...

Sub Test()
Dim rngMulti as Range
Set rngMulti = range("H:I","K:L")
rngMulti.EntireColumn.Hidden = True
End Sub

Hth,
OJ

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Hiding a range of cells

Don't use select. This worked fine for me with H1:O1 merged:

Sub Test()
Dim rng1 As Range, rng2 As Range
With Worksheets("Sheet1")
.Columns.Hidden = False
Set rng1 = .Range("H:I")
Set rng2 = .Range("K:L")
End With
Union(rng1, rng2).EntireColumn.Hidden = True
End Sub

--
Regards,
Tom Ogilvy





"Melvin" wrote in message
...
Hi, I am trying to get a series of columns hidden but when I do this, it
selects the columns H to O as H1-O1 are merged together as a cell. I can't
seem to set the rngMulti.Hidden property either. Any help would be hot!!

Sub Test()
Dim rng1 As Range, rng2 As Range, rngMulti As Range
Worksheets("Sheet 1").Activate
Set rng1 = Range("H:I")
Set rng2 = Range("K:L")
Set rngMulti = Union(rng1 , rng2)
rngMulti.Select
End Sub

Thanks
Melvin




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Hiding a range of cells

Oops...so it does!! Well done Tom!

Reply
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
Hiding data in a range of cells Dobbin0_4 New Users to Excel 5 February 16th 08 06:04 AM
autofilter is hiding cells outisde of the range I am trying to fil dpolking Excel Discussion (Misc queries) 1 October 1st 07 08:31 PM
How can I hide a range of columns without hiding charts there? dbsavoy Charts and Charting in Excel 2 August 31st 06 04:30 PM
Hiding a range prints blank space Ajit Excel Programming 3 August 6th 04 04:21 PM
Hiding Blank lines in named range Carl Brehm Excel Programming 3 August 8th 03 05:17 PM


All times are GMT +1. The time now is 07:49 AM.

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

About Us

"It's about Microsoft Excel"