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

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Derek

Well-known Member
Joined
Feb 16, 2002
Messages
1,592
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
 

G-fer

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

Thanks mate ..... worked perfectly.

Regards .... G-fer
 

Forum statistics

Threads
1,141,728
Messages
5,708,137
Members
421,549
Latest member
Dtcfire

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
Top