View Single Post
  #5   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?

"Dave Peterson" wrote:
Maybe you could add a check.
if ucase(application.caller.address) = ucase("$A$1") then
stop
end if


But I don't think that will protect against the circumstances (unclear to
me) when Excel calculates the same cell multiple times, calling UDFs in the
formula with bogus parameters (empty or zero) each time except the last
time.

Also, for my edification, why do you use UCase?

In my experience, simply Application.Caller.Address = "$A$1" has sufficed.

Am I wrong to expect that?

(Well, surely UCase("$A$1") is unnecessary.)


Or create a new subroutine and use something like:
mycell.formula = mycell.formula


But I am quite sure that will not prevent calculation of other cells unless,
of course, Manual calculation mode is set.

For testing purposes, in Automatic calculation mode, I have relied on
assignments of that form to cause other cells to recalculate. For example,
I have used the following paradigm:

Range("A1").formula = "=ROUND(A2,15)"
For d = lo to hi
Range("A2") = d
If Range("A1") < d Then Stop
Next

This has worked for me. But for my edification, am I wrong to assume that
A1 will be recalucated when the macro changes A2 and Automatic calculation
mode is set?


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

"Dave Peterson" wrote in message
...
Maybe you could add a check.


if ucase(application.caller.address) = ucase("$A$1") then
stop
end if


Or create a new subroutine and use something like:

mycell.formula = mycell.formula

Where myCell is the cell that you're interested in.



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.


--

Dave Peterson