View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
John Bundy John Bundy is offline
external usenet poster
 
Posts: 772
Default Why are my Add-In formulas recalculating everytime I open a workbo

This seems to answer everything, note the Open event

http://www.decisionmodels.com/calcsecretse.htm
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"J. Caplan" wrote:

I know that Excel has smart logic built in to recalculate formulas when it
needs to and that you can manually have it calculate even if nothing has
changed, but is it supposed to recalc unchanged cells on open of an XLS file?

As a test, I created a VBA module (see test code below) and saved the
project as an XLA. I added the Add-In to Excel, opened a workbook, added the
RepeatValue function (see below) to a cell, saved the XLS file, closed Excel
and opened it again. When I open the XLS file, it reruns the macro.

I noticed that the the field says#NAME?. Not sure why it needs to resolve
the name.

Public Function RepeatValue(ByVal cellValue As String, ByVal timesToRepeat
As Integer) As String
Dim ii As Integer
Dim returnString As String

returnString = ""
For ii = 1 To timesToRepeat
returnString = returnString & cellValue
Next ii

MsgBox (returnString) 'Added Msgbox so I could see that this was running
RepeatValue = returnString

End Function