Private Sub Workbook_Open()
If Sheets("Aux").Range("A1").Value < Date Then
Sheets("CAPITAL").Range("M3:M23").ClearContents
End If
Sheets("Aux").Range("A1").Value = Date
End Sub
Private Sub Workbook_Open()
If Sheets("Aux").Range("A1").Value < Date Then
Sheets("CAPITAL").Range("M3:M23").ClearContents
End If
Sheets("Aux").Range("A1").Value = Date
If Weekday(Date, vbSunday) = 1 Then
Sheets("CAPITAL").Range("B7").ClearContents
End If
End Sub
If Weekday(Date, vbSunday) = 1 Then
Sheets("CAPITAL").Range("B7").ClearContents
End If
End Sub
FYI, the code won't run until you first manually open the workbook. The code won't run by itself on sunday midnight even if the workbook is left is openThank you very much! Don't know how to test this without actually waiting for sunday midnight, so i'll get back to you
Just remove the lineI just copied the code somewhere here in mr excel so i just wanna ask if the last part actually ends with "end if .. end sub" without these " Sheets("Aux").Range("A1").Value = Date"
VBA Code:If Weekday(Date, vbSunday) = 1 Then Sheets("CAPITAL").Range("B7").ClearContents End If End Sub
Sheets("Aux").Range("A1").Value = Date
and leave the rest of the code in post#4 as is.That's fine by me. Thanks againFYI, the code won't run until you first manually open the workbook. The code won't run by itself on sunday midnight even if the workbook is left is open
WORKS GREAT! Manually changed the date in my pc a few times and saw that the B7 is removed every sunday only. THANK YOU VERY MUCHWould this work for you ?
VBA Code:Private Sub Workbook_Open() If Sheets("Aux").Range("A1").Value < Date Then Sheets("CAPITAL").Range("M3:M23").ClearContents End If Sheets("Aux").Range("A1").Value = Date If Weekday(Date, vbSunday) = 1 Then Sheets("CAPITAL").Range("B7").ClearContents End If End Sub