Hi Peter,
It's not particularly elegant or high-tech, but the following approach might be suitable for preventing your user-defined functions from recalculating while your macro is executing:
Option Explicit
Dim bMacroRunning As Boolean
Function MyFunction(iMyInput As Integer) As Integer
If bMacroRunning = True Then Exit Function
' This is where MyFunction is defined
MyFunction = iMyInput ^ 2
End Function
Sub MyMacro()
Dim i As Integer
bMacroRunning = True
' This is where all the MyMacro code is entered
For i = 1 To 10
MsgBox "This is iteration no " & i
Next i
bMacroRunning = False
End Sub
Hope this helps - please let me know how you get on.
Regards,
Greg M
Bookmarks