View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Joe User[_2_] Joe User[_2_] is offline
external usenet poster
 
Posts: 905
Default Can I get Excel to recalculate just one cell?

"Prof Wonmug" wrote:
Is there a way to get Excel to recalculate just one cell

[....]
In the past, I've just pressed F2 on the cell in question
and I thought it only re-executed that one cell. Today it
is recalculating the entire sheet and, sometimes, the
entire workbook.


Did you remember to set Manual calculation mode? (Tools Options
Calculation in Excel 2003.)

If not, certainly there are circumstances where "changing" one cell (F2,
then Enter) will cause other cells to be recalculated.

But even with Manual mode set, I think I encountered situations where Excel
recalculates a single cell multiple times for a single change. The first
redundant calculations might call UDFs in the formula with empty or otherwise
invalid parameters. I am sure that Application.Volatile was not an issue; I
almost never use that feature.

That is certainly sometimes the case in Automatic mode. My recollection
about Manual mode might be wrong.

In any case, I finally resorted to the following macro for one reason or
another.

Sub doit()
With Application
.EnableEvents = False
.ScreenUpdating = False
.Calculation = xlCalculationManual
End With

Range("a1").Calculate

With Application
.EnableEvents = True
.ScreenUpdating = True
.Calculation = xlCalculationAutomatic
End With
End Sub


----- original message -----

"Prof Wonmug" wrote:
I have a bug somewhere in a UDF I wrote. I put some breakpoints in the
code, but it's called from 30-40 cells in the worksheet. Is there a
way to get Excel to recalculate just one cell so I don't have to keep
setting and resetting the breakpoints or hit F5 30-40 times until all
of the other cells finish?

In the past, I've just pressed F2 on the cell in question and I
thought it only re-executed that one cell. Today it is recalculating
the entire sheet and, sometimes, the entire workbook.
.