View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
J. Caplan[_2_] J. Caplan[_2_] is offline
external usenet poster
 
Posts: 25
Default Why are my Add-In formulas recalculating everytime I open a workbo

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