Fredrik1987
Board Regular
- Joined
- Nov 5, 2015
- Messages
- 69
I want to calculate the number of days until deadline.
Column G15:G1000 is set as the deadline date.
I have a similiar code in a worksheet_change script, and it works fine.
Also, I'm relatively new to the whole "VBA experience", and haven't really used Workbook_Open() before.
To summarize, the part of the script in Worksheet_Change works fine, I set the case to active and the number of days until deadline appears (this is just a part of a larger script). When I open Excel the next day, nothing happens, the number of days until deadline is the same.
Column G15:G1000 is set as the deadline date.
I have a similiar code in a worksheet_change script, and it works fine.
Also, I'm relatively new to the whole "VBA experience", and haven't really used Workbook_Open() before.
Code:
Sub Workbook_Open(ByVal Target As Range)
If Not Application.Intersect(Target, Range("H15:H1000")) Is Nothing Then
Application.EnableEvents = False
If Target.Value = "Active" And Target.Offset(, -3).Value = "Work" Then _
Target.Offset(, -2).Value = DateDiff("d", Date, Target.Offset(, -1)) & " Days remaining"
End If
End If
End Sub
To summarize, the part of the script in Worksheet_Change works fine, I set the case to active and the number of days until deadline appears (this is just a part of a larger script). When I open Excel the next day, nothing happens, the number of days until deadline is the same.