Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Computing days between TODAY() and older date in a cell | Excel Discussion (Misc queries) | |||
I want any date 90 days or older from current date change color | Excel Worksheet Functions | |||
How do I add a range by date over 90 days older than today | Excel Discussion (Misc queries) | |||
Deleting rows older than current date and inserting a new row | Excel Programming | |||
Dates older than 29 days | Excel Discussion (Misc queries) |