Refresh Excel VBA Function Results

后端 未结 9 1056
悲&欢浪女
悲&欢浪女 2020-11-27 06:01

How can I get a user-defined function to re-evaluate itself based on changed data in the spreadsheet?

I tried F9 and Shift

9条回答
  •  误落风尘
    2020-11-27 06:16

    I found it best to only update the calculation when a specific cell is changed. Here is an example VBA code to place in the "Worksheet" "Change" event:

    Private Sub Worksheet_Change(ByVal Target As Range)
      If Not Intersect(Target, Range("F3")) Is Nothing Then
        Application.CalculateFull
      End If
    End Sub
    

提交回复
热议问题