IDENTIFY CHANGE IN CELL

G-fer

Board Regular
Joined
Jul 18, 2005
Messages
192
Hi all ....

Could you please tell me how to identify when there has been a change in the contents of a cell, caused by a claculation?

For example:

Sheet 1

If the content of A1 changes (doesn't matter what to)
Do something
End if

Regards .....
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Hi there

If you are only interested in changes to A1, you could try this (note that it utilises cell IV1)

Right click the sheet tab then left click View code to open the VB Editor. Paste this in the large code window:

Private Sub Worksheet_Calculate()
If Range("A1").Value <> Range("IV1").Value Then
MsgBox "A1 has changed"
Range("IV1").Value = Range("A1").Value
End If
End Sub

Use Alt+F11 to exit the VB Editor

EDIT: or if you want more specific information about the change you can use this code:

Private Sub Worksheet_Calculate()
If Range("A1").Value <> Range("IV1").Value Then
MsgBox "A1 has changed" & vbCr & vbCr & "Previous value was " & Range("IV1").Value & vbCr & vbCr & "Current value is " & Range("A1").Value
Range("IV1").Value = Range("A1").Value
End If
End Sub


regards
Derek
 
Upvote 0

Forum statistics

Threads
1,213,560
Messages
6,114,309
Members
448,564
Latest member
ED38

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top