I am having a problem with Excel crashing, when I run VBA code on an excel sheet.
I'm trying to add the following formula on worksheet change:
Private Sub Worksheet_Change(ByVal Target As Range) Worksheets("testpage").Range("A1:A8").Formula = "=B1+C1" End Sub
When this code is run i get a message saying "excel has encountered a problem and needs to close" and excel closes.
If I run the code in the
Worksheet_Activate() procedure, it works fine and doesn't crash
Private Sub Worksheet_Activate() Worksheets("testpage").Range("A1:A8").Formula = "=B1+C1" End Sub
But I really need it to work in the
Has anyone experienced similar crashes when using the
Worksheet_Change() event and can anyone point in the right direction to fix this issue ?