Why MS Excel crashes and closes during Worksheet_Change Sub procedure?

前端 未结 3 1442
暗喜
暗喜 2020-11-21 04:45

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 S         


        
3条回答
  •  时光取名叫无心
    2020-11-21 05:14

    Also this solution is good:

    Option Explicit
    Private Busy As Boolean
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Not Busy Then
            Busy = True
            Range("A1:A8").Formula = "=B1+C1"
            Busy = False
        End If
    End Sub
    

提交回复
热议问题