Im trying to loop this macro, which changes the color of the row based upon year, through all of my worksheets in a current workbook and can't seem to figure out how to do so. I've tried to piece some stuff together from other questions and answers to no avail. Any help would be appreciated. Here is the code:
Sub ExpirationYeartoColors()
Dim num As Integer, lr As Long, r As Long
lr = Cells(Rows.Count, "A").End(xlUp).Row
ActiveSheet.Select
For r = 2 To lr
Select Case Range("A" & r).Value
Case Is = "2015"
Range("A" & r).Interior.Color = RGB(181, 189, 0)
Case Is = "2016"
Range("A" & r).Interior.Color = RGB(0, 56, 101)
Case Is = "2017"
Range("A" & r).Interior.Color = RGB(0, 147, 178)
Case Is = "2018"
Range("A" & r).Interior.Color = RGB(155, 211, 221)
Case Is = "2019"
Range("A" & r).Interior.Color = RGB(254, 222, 199)
Case Is = "2020"
Range("A" & r).Interior.Color = RGB(238, 242, 210)
Case "2020" To "2080"
Range("A" & r).Interior.Color = RGB(238, 242, 210)
Case Is = "Unknown"
Range("A" & r).Interior.Color = RGB(197, 200, 203)
Case Is = "Available"
Range("A" & r).Interior.Color = RGB(247, 150, 91)
Case Is = "CommonArea"
Range("A" & r).Interior.Color = RGB(230, 230, 230)
Case Else
Range("A" & r).Interior.Color = RGB(255, 255, 255)
End Select
Next r
On Error GoTo ErrorHandler
' Insert code that might generate an error here
Exit Sub
ErrorHandler:
' Insert code to handle the error here
Resume Next
End Sub