ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hide Rows (Current Date) / Unhide Rows (https://www.excelbanter.com/excel-programming/399067-hide-rows-current-date-unhide-rows.html)

Joe K.

Hide Rows (Current Date) / Unhide Rows
 

Please help me create two macros. First macro, starting with row 10 if dates
are older than 7 days (Date Column D) old then hide them from Sheet1
worksheet. Next macro to unhide all hidden rows starting from row 10 until
cell is empty or null using column A determine if the cell is hidden from
Sheet1 worksheet.

The example listed below the macro should hide 10/01/07 and 10/02/07 since
today is 10/10/07.

Thanks so much!!!!!!!

Example
Column D
10/01/07
10/02/07
10/03/07
10/04/07
10/05/07
10/06/07
10/07/07
10/08/07
10/09/07
10/10/07

Zone[_3_]

Hide Rows (Current Date) / Unhide Rows
 
Does this work for you? Note that UnhideEm just unhides all rows. Should
be okay unless you want some other rows hidden for some reason. HTH, James

Sub HideOld()
Dim k As Long
For k = 10 To Cells(10, "d").End(xlDown).Row
If Cells(k, "d") < Now - 7 Then Rows(k).EntireRow.Hidden = True
Next k
End Sub

Sub UnhideEm()
Rows.Hidden = False
End Sub

"Joe K." <Joe wrote in message
...

Please help me create two macros. First macro, starting with row 10 if
dates
are older than 7 days (Date Column D) old then hide them from Sheet1
worksheet. Next macro to unhide all hidden rows starting from row 10
until
cell is empty or null using column A determine if the cell is hidden from
Sheet1 worksheet.

The example listed below the macro should hide 10/01/07 and 10/02/07 since
today is 10/10/07.

Thanks so much!!!!!!!

Example
Column D
10/01/07
10/02/07
10/03/07
10/04/07
10/05/07
10/06/07
10/07/07
10/08/07
10/09/07
10/10/07





All times are GMT +1. The time now is 12:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com