No Compile Error but code does not run when Invoked in Excel

Jonathan Challinor 96 Reputation points
2021-01-08T15:07:38.107+00:00

Happy New Year All,

I am running a spreadsheet fed by an API, when certain conditions occur the values in the cells change and invoke the VBA. I am getting no compile or code errors from debug but the code does not execute when I enter the relevant values in the relevant cells
Struggling to understand why. Code as follows. Not very complex

Private Sub Worksheet_Change(ByVal Target As Range)
Dim ws As Worksheet: Set ws = Sheet1
Set Target = Range("BK1")
If ws.Range("BK1").Value = 10 Then
Application.EnableEvents = False
With Range("BC10:BC68").Copy
Range("BC10").PasteSpecial Paste:=xlPasteValues
End With
Range("BM1").Value = 1
Application.EnableEvents = True
End If
Set Target = Range("BK2")
If ws.Range("BK2").Value = 5 Then
Application.EnableEvents = False
With Range("BD10:BD68").Copy
Range("BD10").PasteSpecial Paste:=xlPasteValues
End With
Range("BM2").Value = 1
Application.EnableEvents = True
End If
Set Target = Range("BK3")
If ws.Range("BK3").Value = 105 Then
Application.EnableEvents = False
With Range("BE10:BE68").Copy
Range("BE10").PasteSpecial Paste:=xlPasteValues
End With
Range("BM3").Value = 1
Application.EnableEvents = True
End If
End Sub

Thanks

Jonathan

0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jonathan Challinor 96 Reputation points
    2021-01-08T15:13:37.71+00:00

    Sorry All, it's working. No idea, I saved and closed, opened again and it works fine. No help required. Thanks

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.