Hi everyone,
Basically, I have a list of names and reasons for people being on a list. Plus the date their names were added to the list.
What I'm wanting is for the line with their info to be removed after 7 days when we open the spreadsheet.
Referring to the image, lets take row 2-4. Their names were added >= 7 days ago.
So A2:C4 should be automatically removed cleared when we open the spreadsheet.
Column D is automatically generated based on the date in Column C. So if you clear C it will clear D.
My knowledge of VBA is extremely limited. But I've tried to piece a few things together. Which isn't quite working the way I want it too. See below.
Sub removedate()
Dim rw As Long
With ActiveSheet
On Error Resume Next
rw = Application.WorksheetFunction.Match(CDbl(Date), .Range("D:D").Value2, 0)
On Error GoTo 0
If rw = 0 Then
rw = Application.WorksheetFunction.Match(CDbl(Date), .Range("D:D").Value2, 1)
End If
.Range("A1:C" & rw).ClearContents
End With
End Sub
Hope this makes sense. Any assistance is always appreciated.
Basically, I have a list of names and reasons for people being on a list. Plus the date their names were added to the list.
What I'm wanting is for the line with their info to be removed after 7 days when we open the spreadsheet.
Referring to the image, lets take row 2-4. Their names were added >= 7 days ago.
So A2:C4 should be automatically removed cleared when we open the spreadsheet.
Column D is automatically generated based on the date in Column C. So if you clear C it will clear D.
My knowledge of VBA is extremely limited. But I've tried to piece a few things together. Which isn't quite working the way I want it too. See below.
Sub removedate()
Dim rw As Long
With ActiveSheet
On Error Resume Next
rw = Application.WorksheetFunction.Match(CDbl(Date), .Range("D:D").Value2, 0)
On Error GoTo 0
If rw = 0 Then
rw = Application.WorksheetFunction.Match(CDbl(Date), .Range("D:D").Value2, 1)
End If
.Range("A1:C" & rw).ClearContents
End With
End Sub
Hope this makes sense. Any assistance is always appreciated.