Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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


  #2   Report Post  
Posted to microsoft.public.excel.programming
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Why are my Add-In formulas recalculating everytime I open a wo

Yes, but it states: "Excel will automatically recalculate all open workbooks
at each and every change, and whenever you open a workbook. Usually when you
open a workbook in Automatic mode and Excel recalculates you will not see the
recalculation because nothing will have changed since the workbook was saved."

Nothing has changed. To prove this, I had one of my users give me a
spreadsheet that they have that calls UDFs in a 3rd party Add-In that I do
not have. When I open the workbook, it opens fine even though I don't have
the Add-In. When I do something to a cell used in the formula, I get errors
in the cell, as expected. If I add calls to my UDF (written in VBA
code-behind Excel) as well on this workbook, it DOES recalculate them when I
open the workbook, even thought nothing has changed.


"John Bundy" wrote:

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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 968
Default Why are my Add-In formulas recalculating everytime I open a wo

You are correct: Excel calculates all references to XLA UDFs at workbook
open time if calculation is set to automatic.
The only reason I can imagine for this behaviour is that Excel does not know
if the UDF has changed since the workbook was saved, and does not track what
happens during an Excel session.

regards
Charles
__________________________________________________
The Excel Calculation Site
http://www.decisionmodels.com

"J. Caplan" wrote in message
...
Yes, but it states: "Excel will automatically recalculate all open
workbooks
at each and every change, and whenever you open a workbook. Usually when
you
open a workbook in Automatic mode and Excel recalculates you will not see
the
recalculation because nothing will have changed since the workbook was
saved."

Nothing has changed. To prove this, I had one of my users give me a
spreadsheet that they have that calls UDFs in a 3rd party Add-In that I do
not have. When I open the workbook, it opens fine even though I don't
have
the Add-In. When I do something to a cell used in the formula, I get
errors
in the cell, as expected. If I add calls to my UDF (written in VBA
code-behind Excel) as well on this workbook, it DOES recalculate them when
I
open the workbook, even thought nothing has changed.


"John Bundy" wrote:

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




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Why are my Add-In formulas recalculating everytime I open a wo

But I don't get any errors for the cells that refer to the Add-In that I do
not have. So it apparently does not see those cells as changed. The problem
here is that my UDF calls to a database. Many calls can be time consuming.
When I open up a workbook that contains calls to my UDF, you have to wait
while dozens of cells are updated. These dozens of hits to the database is
costly.

"Charles Williams" wrote:

You are correct: Excel calculates all references to XLA UDFs at workbook
open time if calculation is set to automatic.
The only reason I can imagine for this behaviour is that Excel does not know
if the UDF has changed since the workbook was saved, and does not track what
happens during an Excel session.

regards
Charles
__________________________________________________
The Excel Calculation Site
http://www.decisionmodels.com

"J. Caplan" wrote in message
...
Yes, but it states: "Excel will automatically recalculate all open
workbooks
at each and every change, and whenever you open a workbook. Usually when
you
open a workbook in Automatic mode and Excel recalculates you will not see
the
recalculation because nothing will have changed since the workbook was
saved."

Nothing has changed. To prove this, I had one of my users give me a
spreadsheet that they have that calls UDFs in a 3rd party Add-In that I do
not have. When I open the workbook, it opens fine even though I don't
have
the Add-In. When I do something to a cell used in the formula, I get
errors
in the cell, as expected. If I add calls to my UDF (written in VBA
code-behind Excel) as well on this workbook, it DOES recalculate them when
I
open the workbook, even thought nothing has changed.


"John Bundy" wrote:

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







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 968
Default Why are my Add-In formulas recalculating everytime I open a wo

Cells that refer to a non-open addin UDF are treated more like external
references.

For the situation that you describe there is often a way of getting multiple
results from the DB in one hit into a local cache and then having the UDF
query the cache.
One useful technology for this is disconnected ADO recordsets.

Charles
________________________
The Excel Calculation Site
http://www.decisionmodels.com

"J. Caplan" wrote in message
...
But I don't get any errors for the cells that refer to the Add-In that I
do
not have. So it apparently does not see those cells as changed. The
problem
here is that my UDF calls to a database. Many calls can be time
consuming.
When I open up a workbook that contains calls to my UDF, you have to wait
while dozens of cells are updated. These dozens of hits to the database
is
costly.

"Charles Williams" wrote:

You are correct: Excel calculates all references to XLA UDFs at workbook
open time if calculation is set to automatic.
The only reason I can imagine for this behaviour is that Excel does not
know
if the UDF has changed since the workbook was saved, and does not track
what
happens during an Excel session.

regards
Charles
__________________________________________________
The Excel Calculation Site
http://www.decisionmodels.com

"J. Caplan" wrote in message
...
Yes, but it states: "Excel will automatically recalculate all open
workbooks
at each and every change, and whenever you open a workbook. Usually
when
you
open a workbook in Automatic mode and Excel recalculates you will not
see
the
recalculation because nothing will have changed since the workbook was
saved."

Nothing has changed. To prove this, I had one of my users give me a
spreadsheet that they have that calls UDFs in a 3rd party Add-In that I
do
not have. When I open the workbook, it opens fine even though I don't
have
the Add-In. When I do something to a cell used in the formula, I get
errors
in the cell, as expected. If I add calls to my UDF (written in VBA
code-behind Excel) as well on this workbook, it DOES recalculate them
when
I
open the workbook, even thought nothing has changed.


"John Bundy" wrote:

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







  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Why are my Add-In formulas recalculating everytime I open a wo

Actually, I have a routine that will go through the worksheet, gather up all
of the information from the cells that contain my formula and then make one
database hit. I store these results in a cache. I then recalc the cells and
they get the data from the cache. It works great. On startup though, it
does not call this routine as it is trying to re-calc each of my cells
individually first.

"Charles Williams" wrote:

Cells that refer to a non-open addin UDF are treated more like external
references.

For the situation that you describe there is often a way of getting multiple
results from the DB in one hit into a local cache and then having the UDF
query the cache.
One useful technology for this is disconnected ADO recordsets.

Charles
________________________
The Excel Calculation Site
http://www.decisionmodels.com

"J. Caplan" wrote in message
...
But I don't get any errors for the cells that refer to the Add-In that I
do
not have. So it apparently does not see those cells as changed. The
problem
here is that my UDF calls to a database. Many calls can be time
consuming.
When I open up a workbook that contains calls to my UDF, you have to wait
while dozens of cells are updated. These dozens of hits to the database
is
costly.

"Charles Williams" wrote:

You are correct: Excel calculates all references to XLA UDFs at workbook
open time if calculation is set to automatic.
The only reason I can imagine for this behaviour is that Excel does not
know
if the UDF has changed since the workbook was saved, and does not track
what
happens during an Excel session.

regards
Charles
__________________________________________________
The Excel Calculation Site
http://www.decisionmodels.com

"J. Caplan" wrote in message
...
Yes, but it states: "Excel will automatically recalculate all open
workbooks
at each and every change, and whenever you open a workbook. Usually
when
you
open a workbook in Automatic mode and Excel recalculates you will not
see
the
recalculation because nothing will have changed since the workbook was
saved."

Nothing has changed. To prove this, I had one of my users give me a
spreadsheet that they have that calls UDFs in a 3rd party Add-In that I
do
not have. When I open the workbook, it opens fine even though I don't
have
the Add-In. When I do something to a cell used in the formula, I get
errors
in the cell, as expected. If I add calls to my UDF (written in VBA
code-behind Excel) as well on this workbook, it DOES recalculate them
when
I
open the workbook, even thought nothing has changed.


"John Bundy" wrote:

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








  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 968
Default Why are my Add-In formulas recalculating everytime I open a wo

So you must be nearly there, you just need a way of making the UDF do
nothing if the cache is not populated (except maybe notify the DB-Hit
Routine that this UDF needs data), or make the first call to the UDF trigger
getting the cache if its not populated.

Maybe a Global switch that the UDF looks at?

regards
Charles
__________________________________________________
The Excel Calculation Site
http://www.decisionmodels.com



"J. Caplan" wrote in message
...
Actually, I have a routine that will go through the worksheet, gather up
all
of the information from the cells that contain my formula and then make
one
database hit. I store these results in a cache. I then recalc the cells
and
they get the data from the cache. It works great. On startup though, it
does not call this routine as it is trying to re-calc each of my cells
individually first.

"Charles Williams" wrote:

Cells that refer to a non-open addin UDF are treated more like external
references.

For the situation that you describe there is often a way of getting
multiple
results from the DB in one hit into a local cache and then having the UDF
query the cache.
One useful technology for this is disconnected ADO recordsets.

Charles
________________________
The Excel Calculation Site
http://www.decisionmodels.com

"J. Caplan" wrote in message
...
But I don't get any errors for the cells that refer to the Add-In that
I
do
not have. So it apparently does not see those cells as changed. The
problem
here is that my UDF calls to a database. Many calls can be time
consuming.
When I open up a workbook that contains calls to my UDF, you have to
wait
while dozens of cells are updated. These dozens of hits to the
database
is
costly.

"Charles Williams" wrote:

You are correct: Excel calculates all references to XLA UDFs at
workbook
open time if calculation is set to automatic.
The only reason I can imagine for this behaviour is that Excel does
not
know
if the UDF has changed since the workbook was saved, and does not
track
what
happens during an Excel session.

regards
Charles
__________________________________________________
The Excel Calculation Site
http://www.decisionmodels.com

"J. Caplan" wrote in message
...
Yes, but it states: "Excel will automatically recalculate all open
workbooks
at each and every change, and whenever you open a workbook. Usually
when
you
open a workbook in Automatic mode and Excel recalculates you will
not
see
the
recalculation because nothing will have changed since the workbook
was
saved."

Nothing has changed. To prove this, I had one of my users give me a
spreadsheet that they have that calls UDFs in a 3rd party Add-In
that I
do
not have. When I open the workbook, it opens fine even though I
don't
have
the Add-In. When I do something to a cell used in the formula, I
get
errors
in the cell, as expected. If I add calls to my UDF (written in VBA
code-behind Excel) as well on this workbook, it DOES recalculate
them
when
I
open the workbook, even thought nothing has changed.


"John Bundy" wrote:

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










Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Display Current Date & Time in a cell: Everytime I open the workbo sam Excel Worksheet Functions 4 September 3rd 09 11:30 PM
Spreading formulas down the workbook while pulling from 2nd workbo EA4Life Excel Discussion (Misc queries) 3 July 24th 07 07:58 PM
recalculating formulas help terry Excel Discussion (Misc queries) 2 May 10th 07 01:20 PM
Recalculating Array Formulas andym Excel Programming 1 July 10th 06 03:53 AM


All times are GMT +1. The time now is 10:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"