Hide all columns that span a merged cell?

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

Guest

I have a time sheet that has a date in Row 1 that is a merged heading of ten
columns. I would like to be able to hide the entire section(all 10 columns)
of that merged heading.

For instance:
A B C D E F G H I J K
1 4/08/2006
2 d d d d d d d d d d d

Given the date 4/08/2006, I would like to hide all the columns that compose
that section A through K. L through V would be another merged column
heading of 4/15/2006.
 
That helps with the direct question, how do I look at that entire row of
dates and only hide the date I specify? Maybe this should be separate post.

Thanks to you, I know how to hide it, but How do I find it?
 
Dim cell As Range
Set cell = Cells.Find(DateSerial(2006, 4, 8))
cell.MergeArea.EntireColumn.Hidden = True


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
That's elegant, But I can't get it to work, Cell is set to nothing. So maybe
find isn't working.

Thanks for helping,

Stuart
 
That's right, that is what it is. The code should test for it

Dim cell As Range
Set cell = Cells.Find(DateSerial(2006, 4, 8))
If Not cell Is Nothing Then
cell.MergeArea.EntireColumn.Hidden = True
End If

It's not testing another sheet is it?

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
It's like a few friends of mine, it can't seem to find a date or a date
serial. Even if I unformat the column and search for '38815'

Set cell = Cells.Find(38815) ' This doesn't work.

If I change the column to '3881' and code to

Set cell = Cells.Fine(3881) ' This does work.
 
It worked in my (limited) testing, so can I suggest you send me a copy of
the workbook?

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
I believe it doesn't work because L1 merged cell is a formula of the first
date + 7.

I can write a work around replacing the formulas with values...kind of
defeats the purpose of using an excel spreadsheet at that point.

Thanks again to all those who contributed.

Stuart
 
Back
Top