Hi.
I am trying to run a macro when the result of a calculation changes.
A1 on Sheet1 contains =Sheet2!A1+1
I have tried Worksheet_Change event but it doesn't detect it.
Any ideas?
Thanks
Hi.
I am trying to run a macro when the result of a calculation changes.
A1 on Sheet1 contains =Sheet2!A1+1
I have tried Worksheet_Change event but it doesn't detect it.
Any ideas?
Thanks
Semper in excretia sumus; solum profundum variat.
Use the Calculate event.
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
Thanks for quick reply.
I looked at that but don't understand it. Could you give me an example please?
Many thanks
Semper in excretia sumus; solum profundum variat.
Something like this
[vba]
Private Sub Worksheet_Calculate()
Static PrevValue As Variant
If Me.Range("L1").Value <> PrevValue Then
MsgBox "yes"
End If
End Sub
[/vba]
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
Hello,
in the VBEditor, click the sheet on which change you want to react. Above the code window, select "Calculate" from the drop-down, add your code in the sub. It's that easy.
HTH,
Isabella
Thanks xld and IBihy
Semper in excretia sumus; solum profundum variat.
Please remember to mark your threads Solved.
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Has the 'mark it solved' link moved? Can't find it, sorry
Semper in excretia sumus; solum profundum variat.
If you're using Chrome it doesnt show, but it's in the usual place.
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'