Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 57
Default Hide row based on cell value

Colum C shows a date. If the date shown is older than 4 years I want the row
to be hidden.

Is it possible to do this?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Hide row based on cell value

Here's one easy, effective play using a helper col & autofilter ..

Insert a new helper col D, if necessary, next to the dates col C (dates in
col C are presumed real dates recognized by Excel)

Put in D2:
=IF(ISTEXT(C2),"",IF(C2=DATE(YEAR(TODAY())-4,MONTH(TODAY()),DAY(TODAY())),"x",""))
Copy D2 down to cover the max expected extent of data in col C. Col D flags
directly the results that you're after ("x"), ie where the dates in col C are
NOT older than 4 years (the other way around to look at it)

Anytime that you want to exclude/hide dates in col C older than 4 years ..
Just apply autofilter on col D, choose: x
and that's your baby (the filtered results) !

Aloha? Celebrate it here, click the YES button below
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:25,000 Files:300 Subscribers:70
xdemechanik
---
"Munchkin" wrote:
Colum C shows a date. If the date shown is older than 4 years I want the row
to be hidden.

Is it possible to do this?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default Hide row based on cell value

Try the below macro...

Sub HideRows()
For lngRow = 1 To Cells(Rows.Count, 3).End(xlUp).Row
If DateDiff("m", Range("c" & lngRow), Date) 48 And _
0 + Range("c" & lngRow) < 0 Then Rows(lngRow).Hidden = True
Next
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Munchkin" wrote:

Colum C shows a date. If the date shown is older than 4 years I want the row
to be hidden.

Is it possible to do this?

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
Hide sheets based on Cell value Mike Milmoe Excel Discussion (Misc queries) 4 January 16th 07 05:57 AM
Hide cell values based on a condition in another cell Cat Excel Worksheet Functions 1 January 4th 07 07:21 AM
hide rows based on cell value dummster New Users to Excel 1 February 15th 06 11:37 PM
hide rows based on value in cell dummster Excel Discussion (Misc queries) 0 February 15th 06 03:27 PM
Is there a way to HIDE a row based on a value of a cell ? Reddiance Excel Discussion (Misc queries) 4 January 26th 05 02:57 AM


All times are GMT +1. The time now is 12:25 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"