For x = 2 To lastCol
On Error Resume Next
If Cells(13, x).Value <= 50 And Cells(17, x).Value = "Solar" Then
Cells(13, x).Interior.ColorIndex = 45
ElseIf Cells(13, x).Value <= 50 And Cells(17, x).Value = "Gas" Then
Cells(13, x).Interior.ColorIndex = 41
ElseIf Cells(13, x).Value <= 50 And Cells(17, x).Value = "Storage" Then
Cells(13, x).Interior.ColorIndex = 48
ElseIf Cells(13, x).Value <= 50 And Cells(17, x).Value = "Wind" Then
Cells(13, x).Interior.ColorIndex = 44
ElseIf Cells(13, x).Value <= 100 And Cells(17, x).Value = "Solar" Then
Range(Cells(13, x), Cells(12, x)).Interior.ColorIndex = 45
ElseIf Cells(13, x).Value <= 100 And Cells(17, x).Value = "Gas" Then
Range(Cells(13, x), Cells(12, x)).Interior.ColorIndex = 41
ElseIf Cells(13, x).Value <= 100 And Cells(17, x).Value = "Storage" Then
Range(Cells(13, x), Cells(12, x)).Interior.ColorIndex = 48
ElseIf Cells(13, x).Value <= 100 And Cells(17, x).Value = "Wind" Then
Range(Cells(13, x), Cells(12, x)).Interior.ColorIndex = 44
'There's a bunch more of the same code blocks with values incrementing by 50.
ElseIf Cells(13, x).Value > 600 And Cells(17, x).Value = "Solar" Then
Range(Cells(13, x), Cells(1, x)).Interior.ColorIndex = 45
ElseIf Cells(13, x).Value > 600 And Cells(17, x).Value = "Gas" Then
Range(Cells(13, x), Cells(1, x)).Interior.ColorIndex = 41
ElseIf Cells(13, x).Value > 600 And Cells(17, x).Value = "Storage" Then
Range(Cells(13, x), Cells(1, x)).Interior.ColorIndex = 48
ElseIf Cells(13, x).Value > 600 And Cells(17, x).Value = "Wind" Then
Range(Cells(13, x), Cells(2, x)).Interior.ColorIndex = 44
End If
'This section inserts vertical lines to better view each entry
Range(Cells(1, x), Cells(17, x)).Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlMedium
End With
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlMedium
End With
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Next x
'Color index numbers and fuel type
'solar - orange - 45
'gas - blue - 41
'storage - grey - 48
'wind - yellow - 44
MsgBox "COD Timeline has been updated."
Bookmarks