I get the runtime error 424 Object Required message when I run the vba code below. To insert this code I right clicked the worksheet "Results" in workbook "DoubleElimResults.xlsm". I'm trying to activate the workbook "DoubleElimDrawSheet.xlsm" but get the error when the line - "Workbooks(“DoubleElimDrawSheet.xlsm”).Activate" is reached. I can put the activate command in a regular macro and it works fine but I need to have it in this code so I can change background colors on the draw sheet when a cell in the target range changes. This is just the initial vba code to get it working and I will have well over 150 cells to manipulate which is cumbersome to set up using conditional formatting.
Here is the code and I'm attaching the two workbooks plus a third which isn't part of the problem but is referenced in formulas.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCells As Range
' The variable KeyCells contains the cells that will
' cause an alert when they are changed.
Set KeyCells = Range("B18:B34")
Dim MatchID As String
Dim MatchPos As String
If Not Application.Intersect(KeyCells, Range(Target.Address)) _
Is Nothing Then
If Target.Address = "$B$18" Then
If Range("C18").Value = "U" _
Or Range("C18").Value = "L" Then
MatchID = "W17"
MatchPos = Range("C2").Value
Workbooks(“DoubleElimDrawSheet.xlsm”).Activate
Sheets(“Brackets”).Select
If MatchPos = "U" And Range("J1") = "Y" Then
Range("P70").Interior.Color = RGB(255, 255, 0)
Range("I70").Interior.Color = RGB(146, 208, 80)
Else
Range("I70").Interior.Color = RGB(102, 255, 51)
Range("I70").Interior.Color = RGB(146, 208, 80)
End If
End If
End If
Windows("DoubleElimResults.xlsm").Activate
End If
End Sub
Thanks for any help resolving this error.
Bookmarks