OWC10 spreadsheet Range_Change event confusion

C

cellbert

I handle the Change event on cell A1 in an OWC
spreadsheet. The cell has a formula =A2. I turn
Spreadsheet.Calculation to manual. I enter a new value
for A2. The Change event handler gets called, even
though, within the Change event, the value of A1 is
unchanged (as it should be). Question is, why does that
Change event get raised? - with calc manual, nothing is
changing. I'll see if it's the same in "big" Excel, but
either way, it sounds wrong.
 
C

cellbert

Dan,
Thx for response. Actually, I'm talking about the Change
event on a Range object, not the SheetChange event on the
Spreadsheet class. In this instance, in a class module

Dim WithEvents rng as Range

Public Sub Init(ss as Spreadsheet)
set rng = ss.Range("A1")
rng.Formula = "=A3"
End Sub

Private Sub rng_Change()
Debug.Print "range changed"
End Sub

Public Sub Calc(ss as Spreadsheet)
ss.Calculation = xlCalculationManual
ss.Range("A3").Value=12
ss.Calculation = xlCalculationAutomatic
End Sub

Then call Init and Calc
The rng_Change routine gets called 3 times, once when the
range's formula is set in Init, once when the value of
range A3 is set in Calc (that's when it shouldn't be), and
once when calculation state is set to automatic. Anyway,
it's an easy workaround, but . . .

-- hk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top