Worksheet Calculations Exclude Custom Formula

  • Thread starter Thread starter Geoff
  • Start date Start date
G

Geoff

I want to exclude certain custom calculations calculating when I use the VBA
worksheet calculate event (i.e. Activesheet.Calculate) on custom functions.
Is this possible?

Thanks in advance
 
This seemed to work in simple testing. Maybe you can enhance it:

Option Explicit
Public StopCalc As Boolean
Function myFunc() As Variant
Application.Volatile True
If StopCalc Then
myFunc = Application.Caller.Text
Exit Function
Else
myFunc = Now
End If
End Function
Sub testme01()
StopCalc = True
ActiveSheet.Calculate
StopCalc = False
End Sub
Sub testme02()
ActiveSheet.Calculate
End Sub
 
Thanks - Had .value which did not work.

Dave Peterson said:
This seemed to work in simple testing. Maybe you can enhance it:

Option Explicit
Public StopCalc As Boolean
Function myFunc() As Variant
Application.Volatile True
If StopCalc Then
myFunc = Application.Caller.Text
Exit Function
Else
myFunc = Now
End If
End Function
Sub testme01()
StopCalc = True
ActiveSheet.Calculate
StopCalc = False
End Sub
Sub testme02()
ActiveSheet.Calculate
End Sub
 
You may have gotten a faster response if you had shared your code and indicated
what didn't work.
 
True. I was trying different methods with one even being an iteration
process to find, but this was not optimal. Thanks again and will do next
time.
 
Back
Top