View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mike King Mike King is offline
external usenet poster
 
Posts: 6
Default VBA Precedence Problem

The following steps will show you how to reproduce the problem that I'm
having. In the following test case, I would expect the following to occur.
When I update the contents of cell A1, Excel should update the cells that
depend on it, so cell B1 should be updated then C1 because C1 depends on B1.
This is not what happens. C1 gets updated before B1. Can anyone explain
this or offer a workaround?


Create New Workbook
Set B1 to equal "=A1"
Set C1 to equal "=MyTest(B1)"
Insert VBA Module into Workbook
Create a function (see below)
Public Function MyTest(r As Range) As String
MyTest = r.Text
End Function

A1 should be empty
B1 should be 0
C1 should say #NAME?
Type a into A1
B1 should say "a"
*** C1 should say "a" but it doesn't it say "0"



P.S. I'm using Windows XP SP2 with Office XP SP3