View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
joeu2004 joeu2004 is offline
external usenet poster
 
Posts: 2,059
Default Cell updates not occuring

Errata....

I wrote:
Private Sub Workbook_Open()
Range("Z1").Clear
End Sub


Of course, it would be better to name the cell and refer to the cell name in
the macro, because the cell location might change due to worksheet
modifications.


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

"JoeU2004" wrote in message
...
"mark_the_yeti" wrote:
The Application.Volatile solution worked very well.


Are you aware that that causes those functions to be executed every time
any cell in the workbook is modified?

Alternatively, I would be inclined to do the following.

First, create a Workbook_Open event macro. Choose one unused cell in the
workbook, say Z1, and do the following:

Private Sub Workbook_Open()
Range("Z1").Clear
End Sub

(Of course, Z1 does not have to be totally unused. It can be any cell
that Workbook_Open modifies for whatever purpose.)

Then, for each function that you want executed with the workbook is
opened, create a dependency on Z1 either by passing it as an unused
parameter or by including it in the computation, e.g. MarkP(...)+Z1 or
MarkP(...)&Z1 depending on the type of the value returned by the function.

Of course, you could accomplish the same thing by having the Workbook_Open
macro directly calculate the cells that contain references to the
functions that you want executed when the workbook is opened; e.g.
Range("B1").Calculate.

The problem with that is: if you move those cells or otherwise cause them
to be moved, Range("B1") might no longer be correct. You can ameliorate
that problem by naming all of the cells and ranges of cells to be executed
when the workbook is opened, and Range("name") in the Workbook_Open macro.


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

"mark_the_yeti" wrote in message
...
The Application.Volatile solution worked very well.

alt+shift+ctrl+F9 worked as well, but bogged down my PC for a full minute
or
two.

The 2007 vs. 2003 issue I described was occuring becuse there's an
additional; option to enable linked content in 2007 that was not being
actived.

My spreadsheet now works exactly as I'd hoped. Thank you!

"mark_the_yeti" wrote:

Please also note that I'm working in Excel 2003. When I asked a
colleague to
try this, he was unable to even get the "enter and exit" solution to
work in
Excel 2007....

Also, the formula in the worksheet cell is "=markp($F4,4,454)" in one
case
anyway.

"mark_the_yeti" wrote:

I have many cells using a formula I created in VBA (below).

When the workbook opens it asks me to allow macro, and I do. Then it
asks
if I want to update, and I do. The cells remain un-updated, however,
until I
double-click on them as if to edit, then hit enter. Only then does
any one
cell update.

I have made sure the File-Options-Calculate-Autocalculate option has
been
selected.
F9 has no effect.

Note that the worksheet "Mark P" is hidden in this workbook, and the
values
in Mark P are coming from a worksheet in a different workbook. I have
confirmed that this part is working properly, though.

You help is seincerely appreciated.

Function MarkP(task, start, fin)
hours = 0
For Row = start To fin
Set curCell = Worksheets("Mark P").Cells(Row, 4)
Set valCell = Worksheets("Mark P").Cells(Row, 5)
If curCell.Value = task Then
hours = hours + valCell.Value
End If
Next Row
MarkP = hours

End Function