Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Unhide Rows Date Older Than 7 Days


I would like to create a macro to unhide rows in Sheet1 with Dates in Column
(C) that are older than 7 days old from current day. The Dates are in Column
(C) starting in row 2.

Please help me create this unhide macro.

Thanks,

Dean P.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Unhide Rows Date Older Than 7 Days


Sub hiderows()

'unhide everything
Cells.Select
Selection.EntireColumn.Hidden = False
LastRow = Cells(Rows.Count, "C").End(xlUp).Row
Set ColCRange = Range("C1:C" & LastRow)

For Each cell In ColCRange
If Date - cell.Value 7 Then
Cells.EntireRow.Hidden = True
End If

Next cell


End Sub
"Dean P." wrote:


I would like to create a macro to unhide rows in Sheet1 with Dates in Column
(C) that are older than 7 days old from current day. The Dates are in Column
(C) starting in row 2.

Please help me create this unhide macro.

Thanks,

Dean P.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 638
Default Unhide Rows Date Older Than 7 Days

One way:
Sub this()
Rows.Hidden = False
For i = 2 To Cells(Rows.Count, 3).End(xlUp).Row
If Not IsDate(Cells(i, 3).Value) Or _
Not Cells(i, 3).Value < Date - 7 Then _
Cells(i, 3).EntireRow.Hidden = True
Next i
End Sub

This will hide anything that is not a date as well.
Dean P. wrote:
I would like to create a macro to unhide rows in Sheet1 with Dates in Column
(C) that are older than 7 days old from current day. The Dates are in Column
(C) starting in row 2.

Please help me create this unhide macro.

Thanks,

Dean P.


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
Computing days between TODAY() and older date in a cell Big UT Fan Excel Discussion (Misc queries) 3 November 14th 06 08:14 PM
I want any date 90 days or older from current date change color Big Abalone Excel Worksheet Functions 5 April 23rd 06 05:01 AM
How do I add a range by date over 90 days older than today John DeLosa Excel Discussion (Misc queries) 4 February 16th 06 09:30 PM
Deleting rows older than current date and inserting a new row Dan E.[_2_] Excel Programming 4 December 14th 05 03:16 PM
Dates older than 29 days ab Excel Discussion (Misc queries) 2 June 16th 05 09:52 PM


All times are GMT +1. The time now is 08:44 PM.

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"