View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default VBA Function running order

The ordering is complicated because a change in the spreadsheet causes a
worksheet change event. This event, depending if it is enable, can cause the
VBA code to stop executing and the worksheet to update. Therefore if the
macro changes cell B4 and cell C5 has a function using cell B4, C5 will also
get updated.

"KevinTHFC" wrote:

I am very confused, hopefully some kind person can help me?

I have a spreadsheet recording results and various information across a
spreadsheet.

So day 1 results and info are stored in A3,B3,C3........H3
day 2 in A4,B4,C4.......H4
last day in A1500,B1500,C1500......H1500

I have a function in K3 that uses the info in A3 to H3 to create a result.
This function is replicated down to K1500 and works perfectly in that I get
the expected results displayed.

However when stepping through with the debugger I see that the order of the
cells being calculated is very strange in that it goes
K3,K4,K1500,K1499,K1498........K5

THis wouldn't be a problem except that I now need to ensure that the cells
are filled out sequentially ie K3,K4,K5.....K1500

Anyone have any ideas?

Many Thanks

Kevin