Fredrik1987
Board Regular
- Joined
- Nov 5, 2015
- Messages
- 69
I posted a similiar question earlier, but it was difficult to understand what my exact questions were.
So here goes another try:
This is my worksheet:
The problem is that column D, Days remaining doesn't update regularly.
I want it to count down the remaining number of days automatically.
So here goes another try:
This is my worksheet:
Code:
Sub Worksheet_Change(ByVal Target As Range)
' Activate the date when I set case as "Active"
If Not Application.Intersect(Target, Range("A1:A1000")) Is Nothing Then
Application.EnableEvents = False
If Target.Value = "Active" Then _
' Date activated
Target.Offset(, 1).Value = Date
' If the work must be done within 12 weeks, set the deadline date into column C (usually we have 12 weeks)
Target.Offset(, 2).Value = DateAdd("d", 12 * 7, Date)
' Show the number of days in column D
Target.Offset(, 3).Value = DateDiff("d", Date, Target.Offset(, 2)) & " Dager igjen"
End If
End If
End Sub
Sub Workbook_change(ByVal Target As Range)
' Copied from the script above"
If Not Application.Intersect(Target, Range("A15:A1000")) Is Nothing Then
Application.EnableEvents = False
If Target.Value = "Active" Then _
' This is the part I'm having trouble with, the number of days remaining doesn't change as the deadline approaches
' Show the number of days remaining in column D
Target.Offset(, 3).Value = DateDiff("d", Date, Target.Offset(, 2)) & " Dager igjen"
End If
End If
End Sub
The problem is that column D, Days remaining doesn't update regularly.
I want it to count down the remaining number of days automatically.