Mario Navarrete
New Member
Hello everyone,
I'm an absolute noob to programming and I'm having trouble with a large bit of code. I receive the compile error saying "procedure too large" and I don't know how to break my code down. I have 300 circles to run this code through and I can barely get a dozen or so done before hitting the 64kb limit. I have placed the code for the first 15 here in hopes that someone can help show me how to either shorten it dramatically or break it down into parts. Please be kind, i'm an absolute beginner at this so if this is an easy thing to do, I apologize in advance.
Thanks!
I'm an absolute noob to programming and I'm having trouble with a large bit of code. I receive the compile error saying "procedure too large" and I don't know how to break my code down. I have 300 circles to run this code through and I can barely get a dozen or so done before hitting the 64kb limit. I have placed the code for the first 15 here in hopes that someone can help show me how to either shorten it dramatically or break it down into parts. Please be kind, i'm an absolute beginner at this so if this is an easy thing to do, I apologize in advance.
Thanks!
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myTriggerCell As Range
Set myTriggerCell = Range("A1:A300")
If Not Application.Intersect(myTriggerCell, Target) Is Nothing Then
Select Case Range("A1").Value
Case "Available": ActiveSheet.Shapes("Oval 1").Fill.ForeColor.RGB = RGB(102, 204, 0)
Case "Reserved": ActiveSheet.Shapes("Oval 1").Fill.ForeColor.RGB = RGB(255, 255, 51)
Case "Future Lot": ActiveSheet.Shapes("Oval 1").Fill.ForeColor.RGB = RGB(160, 160, 160)
Case "Sold": ActiveSheet.Shapes("Oval 1").Fill.ForeColor.RGB = RGB(204, 0, 0)
End Select
End If
If Not Application.Intersect(myTriggerCell, Target) Is Nothing Then
Select Case Range("A2").Value
Case "Available": ActiveSheet.Shapes("Oval 2").Fill.ForeColor.RGB = RGB(102, 204, 0)
Case "Reserved": ActiveSheet.Shapes("Oval 2").Fill.ForeColor.RGB = RGB(255, 255, 51)
Case "Future Lot": ActiveSheet.Shapes("Oval 2").Fill.ForeColor.RGB = RGB(160, 160, 160)
Case "Sold": ActiveSheet.Shapes("Oval 2").Fill.ForeColor.RGB = RGB(204, 0, 0)
End Select
End If
If Not Application.Intersect(myTriggerCell, Target) Is Nothing Then
Select Case Range("A3").Value
Case "Available": ActiveSheet.Shapes("Oval 3").Fill.ForeColor.RGB = RGB(102, 204, 0)
Case "Reserved": ActiveSheet.Shapes("Oval 3").Fill.ForeColor.RGB = RGB(255, 255, 51)
Case "Future Lot": ActiveSheet.Shapes("Oval 3").Fill.ForeColor.RGB = RGB(160, 160, 160)
Case "Sold": ActiveSheet.Shapes("Oval 3").Fill.ForeColor.RGB = RGB(204, 0, 0)
End Select
End If
If Not Application.Intersect(myTriggerCell, Target) Is Nothing Then
Select Case Range("A4").Value
Case "Available": ActiveSheet.Shapes("Oval 4").Fill.ForeColor.RGB = RGB(102, 204, 0)
Case "Reserved": ActiveSheet.Shapes("Oval 4").Fill.ForeColor.RGB = RGB(255, 255, 51)
Case "Future Lot": ActiveSheet.Shapes("Oval 4").Fill.ForeColor.RGB = RGB(160, 160, 160)
Case "Sold": ActiveSheet.Shapes("Oval 4").Fill.ForeColor.RGB = RGB(204, 0, 0)
End Select
End If
If Not Application.Intersect(myTriggerCell, Target) Is Nothing Then
Select Case Range("A5").Value
Case "Available": ActiveSheet.Shapes("Oval 5").Fill.ForeColor.RGB = RGB(102, 204, 0)
Case "Reserved": ActiveSheet.Shapes("Oval 5").Fill.ForeColor.RGB = RGB(255, 255, 51)
Case "Future Lot": ActiveSheet.Shapes("Oval 5").Fill.ForeColor.RGB = RGB(160, 160, 160)
Case "Sold": ActiveSheet.Shapes("Oval 5").Fill.ForeColor.RGB = RGB(204, 0, 0)
End Select
End If
If Not Application.Intersect(myTriggerCell, Target) Is Nothing Then
Select Case Range("A6").Value
Case "Available": ActiveSheet.Shapes("Oval 6").Fill.ForeColor.RGB = RGB(102, 204, 0)
Case "Reserved": ActiveSheet.Shapes("Oval 6").Fill.ForeColor.RGB = RGB(255, 255, 51)
Case "Future Lot": ActiveSheet.Shapes("Oval 6").Fill.ForeColor.RGB = RGB(160, 160, 160)
Case "Sold": ActiveSheet.Shapes("Oval 6").Fill.ForeColor.RGB = RGB(204, 0, 0)
End Select
End If
If Not Application.Intersect(myTriggerCell, Target) Is Nothing Then
Select Case Range("A7").Value
Case "Available": ActiveSheet.Shapes("Oval 7").Fill.ForeColor.RGB = RGB(102, 204, 0)
Case "Reserved": ActiveSheet.Shapes("Oval 7").Fill.ForeColor.RGB = RGB(255, 255, 51)
Case "Future Lot": ActiveSheet.Shapes("Oval 7").Fill.ForeColor.RGB = RGB(160, 160, 160)
Case "Sold": ActiveSheet.Shapes("Oval 7").Fill.ForeColor.RGB = RGB(204, 0, 0)
End Select
End If
If Not Application.Intersect(myTriggerCell, Target) Is Nothing Then
Select Case Range("A8").Value
Case "Available": ActiveSheet.Shapes("Oval 8").Fill.ForeColor.RGB = RGB(102, 204, 0)
Case "Reserved": ActiveSheet.Shapes("Oval 8").Fill.ForeColor.RGB = RGB(255, 255, 51)
Case "Future Lot": ActiveSheet.Shapes("Oval 8").Fill.ForeColor.RGB = RGB(160, 160, 160)
Case "Sold": ActiveSheet.Shapes("Oval 8").Fill.ForeColor.RGB = RGB(204, 0, 0)
End Select
End If
If Not Application.Intersect(myTriggerCell, Target) Is Nothing Then
Select Case Range("A9").Value
Case "Available": ActiveSheet.Shapes("Oval 9").Fill.ForeColor.RGB = RGB(102, 204, 0)
Case "Reserved": ActiveSheet.Shapes("Oval 9").Fill.ForeColor.RGB = RGB(255, 255, 51)
Case "Future Lot": ActiveSheet.Shapes("Oval 9").Fill.ForeColor.RGB = RGB(160, 160, 160)
Case "Sold": ActiveSheet.Shapes("Oval 9").Fill.ForeColor.RGB = RGB(204, 0, 0)
End Select
End If
If Not Application.Intersect(myTriggerCell, Target) Is Nothing Then
Select Case Range("A10").Value
Case "Available": ActiveSheet.Shapes("Oval 10").Fill.ForeColor.RGB = RGB(102, 204, 0)
Case "Reserved": ActiveSheet.Shapes("Oval 10").Fill.ForeColor.RGB = RGB(255, 255, 51)
Case "Future Lot": ActiveSheet.Shapes("Oval 10").Fill.ForeColor.RGB = RGB(160, 160, 160)
Case "Sold": ActiveSheet.Shapes("Oval 10").Fill.ForeColor.RGB = RGB(204, 0, 0)
End Select
End If
If Not Application.Intersect(myTriggerCell, Target) Is Nothing Then
Select Case Range("A11").Value
Case "Available": ActiveSheet.Shapes("Oval 11").Fill.ForeColor.RGB = RGB(102, 204, 0)
Case "Reserved": ActiveSheet.Shapes("Oval 11").Fill.ForeColor.RGB = RGB(255, 255, 51)
Case "Future Lot": ActiveSheet.Shapes("Oval 11").Fill.ForeColor.RGB = RGB(160, 160, 160)
Case "Sold": ActiveSheet.Shapes("Oval 11").Fill.ForeColor.RGB = RGB(204, 0, 0)
End Select
End If
If Not Application.Intersect(myTriggerCell, Target) Is Nothing Then
Select Case Range("A12").Value
Case "Available": ActiveSheet.Shapes("Oval 12").Fill.ForeColor.RGB = RGB(102, 204, 0)
Case "Reserved": ActiveSheet.Shapes("Oval 12").Fill.ForeColor.RGB = RGB(255, 255, 51)
Case "Future Lot": ActiveSheet.Shapes("Oval 12").Fill.ForeColor.RGB = RGB(160, 160, 160)
Case "Sold": ActiveSheet.Shapes("Oval 12").Fill.ForeColor.RGB = RGB(204, 0, 0)
End Select
End If
If Not Application.Intersect(myTriggerCell, Target) Is Nothing Then
Select Case Range("A13").Value
Case "Available": ActiveSheet.Shapes("Oval 13").Fill.ForeColor.RGB = RGB(102, 204, 0)
Case "Reserved": ActiveSheet.Shapes("Oval 13").Fill.ForeColor.RGB = RGB(255, 255, 51)
Case "Future Lot": ActiveSheet.Shapes("Oval 13").Fill.ForeColor.RGB = RGB(160, 160, 160)
Case "Sold": ActiveSheet.Shapes("Oval 13").Fill.ForeColor.RGB = RGB(204, 0, 0)
End Select
End If
If Not Application.Intersect(myTriggerCell, Target) Is Nothing Then
Select Case Range("A14").Value
Case "Available": ActiveSheet.Shapes("Oval 14").Fill.ForeColor.RGB = RGB(102, 204, 0)
Case "Reserved": ActiveSheet.Shapes("Oval 14").Fill.ForeColor.RGB = RGB(255, 255, 51)
Case "Future Lot": ActiveSheet.Shapes("Oval 14").Fill.ForeColor.RGB = RGB(160, 160, 160)
Case "Sold": ActiveSheet.Shapes("Oval 14").Fill.ForeColor.RGB = RGB(204, 0, 0)
End Select
End If
If Not Application.Intersect(myTriggerCell, Target) Is Nothing Then
Select Case Range("A15").Value
Case "Available": ActiveSheet.Shapes("Oval 15").Fill.ForeColor.RGB = RGB(102, 204, 0)
Case "Reserved": ActiveSheet.Shapes("Oval 15").Fill.ForeColor.RGB = RGB(255, 255, 51)
Case "Future Lot": ActiveSheet.Shapes("Oval 15").Fill.ForeColor.RGB = RGB(160, 160, 160)
Case "Sold": ActiveSheet.Shapes("Oval 15").Fill.ForeColor.RGB = RGB(204, 0, 0)
End Select
End If
End Sub