How do I automatically hide columns? in Excel General Questions  
 |  Edit my Profile  |  Help
 
     
  
 
 
 
PPM at Brackmills 2/10/2006 8:37 AM PST
  Question
  I have a table with dates as the top row. I want Excel to find todays date
and then hide the columns after todays date. In this way I can make the
printed output bigger and more readable.
 
  Was this post helpful to you?  
 
 
  Reply | Print post   TopTop  
 
 
 
 
Don Guillett 2/10/2006 8:56 AM PST
  Answer
  try
Sub findtoday_hidecolsafter()
x = Rows(2).Find(Date).Column + 1
Range(Cells(1, x), Cells(1, Columns.Count)).Columns.Hidden = True
End Sub


--
Don Guillett
SalesAid Software
dguillett1@austin.rr.com
"PPM at Brackmills" <PPM at Brackmills@discussions.microsoft.com> wrote in
message news:BA2F1528-4BC0-4385-B719-83EE21BFC0A3@microsoft.com...
>I have a table with dates as the top row. I want Excel to find todays date
> and then hide the columns after todays date. In this way I can make the
> printed output bigger and more readable.


 
  Was this post helpful to you?  
 
 
  Reply | Print post   TopTop  
 
 
 
 
skyap 6/24/2008 4:55 AM PST
   
  I was looking to do the same (but with the dates at the start of rows). I
have tried this bit of code but how do I get it to actually run?

"Don Guillett" wrote:

> try
> Sub findtoday_hidecolsafter()
> x = Rows(2).Find(Date).Column + 1
> Range(Cells(1, x), Cells(1, Columns.Count)).Columns.Hidden = True
> End Sub
>
>
> --
> Don Guillett
> SalesAid Software
> dguillett1@austin.rr.com
> "PPM at Brackmills" <PPM at Brackmills@discussions.microsoft.com> wrote in
> message news:BA2F1528-4BC0-4385-B719-83EE21BFC0A3@microsoft.com...
> >I have a table with dates as the top row. I want Excel to find todays date
> > and then hide the columns after todays date. In this way I can make the
> > printed output bigger and more readable.
>
>
>
 
  Was this post helpful to you?  
 
 
  Reply | Print post   TopTop  
 
 
 
 
Chip Pearson 2/10/2006 8:59 AM PST
  Answer
  You can do this with some simple VBA code:

Sub AAA()
Dim Rng As Range
Dim Found As Boolean
For Each Rng In Range(Cells(1, 1), Cells(1, Columns.Count)).Cells
If Rng.Value = Date Then
Found = True
Exit For
End If
Next Rng
If Found = True Then
Range(Rng(1, 2), Cells(1, Columns.Count)).EntireColumn.Hidden
= True
End If
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"PPM at Brackmills" <PPM at Brackmills@discussions.microsoft.com>
wrote in message
news:BA2F1528-4BC0-4385-B719-83EE21BFC0A3@microsoft.com...
>I have a table with dates as the top row. I want Excel to find
>todays date
> and then hide the columns after todays date. In this way I can
> make the
> printed output bigger and more readable.


 
  Was this post helpful to you?  
 
 
  Reply | Print post   TopTop  
 
 
 
 
iallen 6/20/2008 10:14 AM PST
   
  how do I hide a column and only have it unhide automatically if data is
present in those cells?

 
  Was this post helpful to you?  
 
 
  Reply | Print post   TopTop  
 
 
 
 
plumfin 7/21/2008 8:24 AM PST
   
  Hi, I am looking for the same answer on rows. thanks, kelly

"iallen" wrote:

> how do I hide a column and only have it unhide automatically if data is
> present in those cells?
>
>
 
  Was this post helpful to you?  
 
 
  Reply | Print post   TopTop  
 
 
 
 
valleycat125 7/29/2008 12:30 PM PST
   
  I need this information as well. I have a "Quote" being generated that,
depending on the amount of items requested, there may be 5-10 blank rows
before the next section of the quote...I would like to have the rows either
automatically hidden or deleted if there is no quantity on the data. Can
anyone help!?

Thanks.


"plumfin" wrote:

> Hi, I am looking for the same answer on rows. thanks, kelly
>
> "iallen" wrote:
>
> > how do I hide a column and only have it unhide automatically if data is
> > present in those cells?
> >
> >
 
  Was this post helpful to you?  
 
 
  Reply | Print post   TopTop  
 
 
  Return to Microsoft Communities  Notify me of replies