Have have a excel spreadsheets with 2 columns. One with the employees name and one with the date that their warning expires. I would like the employees name to be automatically removed after the date expires. How do I do this.
Have have a excel spreadsheets with 2 columns. One with the employees name and one with the date that their warning expires. I would like the employees name to be automatically removed after the date expires. How do I do this.
Last edited by Paul; 07-30-2014 at 12:06 PM.
I presume the names are in Column A and the dates are in Column B on Sheet1 then, try the following macro:
copy this code to the ThisWorkbook Object and enable macros by default for this workbook. Then this code will run everytime the workbook is opened and will delete all expired rows.![]()
Private Sub Workbook_Open() Dim i as long, ilastrow as long With Thisworkbook.Worksheets("Sheet1") 'replace Sheet1 with the actual sheet name ilastrow = .range("A" & .rows.count).end(xlup).row 'replace A with the column with names For i = ilastrow to 1 step -1 if .range("B" & i) > Date then .range("A" & i).EntireRow.Delete 'replace B with the column with dates Next i End With End Sub
HTH!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks