Heres the fix when updating to 2013
Private Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCells As Range
Set KeyCells = Range("F2:F300")
If Not Application.Intersect(KeyCells, Range(Target.Address)) _
Is Nothing Then
Dim StringDate As String
'Column number with the date in it (column a = 1, column b = 2, column c = 3, etc)
ColumnWithDate = 6
'Column number with the conditional formatting for the traffic lights in it
ColumnForResults = 7
StringDate = Date
GreenDate = DateAdd("d", 14, StringDate)
'What row to start the update on (skip your header/title row)
BeginRow = 2
'What row to end the update on (the more you update the longer it will take to run)
EndRow = 32
If ActiveSheet.Cells(Target.Row, Target.Column).Value <= StringDate Then
ActiveSheet.Cells(Target.Row, Target.Column + 1) = "1"
End If
If ActiveSheet.Cells(Target.Row, Target.Column).Value > StringDate And ActiveSheet.Cells(Target.Row, Target.Column).Value < GreenDate Then
ActiveSheet.Cells(Target.Row, Target.Column + 1) = "2"
End If
If ActiveSheet.Cells(Target.Row, Target.Column).Value >= GreenDate Then
ActiveSheet.Cells(Target.Row, Target.Column + 1) = "3"
End If
If ActiveSheet.Cells(Target.Row, Target.Column).Value = "" Then
ActiveSheet.Cells(Target.Row, Target.Column + 1) = ""
End If
End If
End Sub
Sub FullUpdate()
Dim StringDate As String
'Column number with the date in it (column a = 1, column b = 2, column c = 3, etc)
ColumnWithDate = 6
'Column number with the conditional formatting for the traffic lights in it
ColumnForResults = 7
StringDate = Date
GreenDate = DateAdd("d", 14, StringDate)
'What row to start the update on (skip your header/title row)
BeginRow = 2
'What row to end the update on (the more you update the longer it will take to run)
EndRow = 32
For RowCnt = BeginRow To EndRow
If ActiveWorkbook.Worksheets("Sheet1").Cells(RowCnt, ColumnWithDate) <= StringDate Then
ActiveWorkbook.Worksheets("Sheet1").Cells(RowCnt, ColumnForResults) = "1"
End If
If (ActiveWorkbook.Worksheets("Sheet1").Cells(RowCnt, ColumnWithDate) > StringDate) And (ActiveWorkbook.Worksheets("Sheet1").Cells(RowCnt, ColumnWithDate) < GreenDate) Then
ActiveWorkbook.Worksheets("Sheet1").Cells(RowCnt, ColumnForResults) = "2"
End If
If (ActiveWorkbook.Worksheets("Sheet1").Cells(RowCnt, ColumnWithDate) >= GreenDate) Then
ActiveWorkbook.Worksheets("Sheet1").Cells(RowCnt, ColumnForResults) = "3"
End If
If ActiveWorkbook.Worksheets("Sheet1").Cells(RowCnt, ColumnWithDate) = "" Then
ActiveWorkbook.Worksheets("Sheet1").Cells(RowCnt, ColumnForResults) = ""
End If
Next RowCnt
End Sub
Bookmarks