MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Excel VBA Check When Cell Has Changed

  Asked By: Meenachi    Date: Dec 21    Category: MS Office    Views: 6764

How do I use VBA etc.. to determine when a specific cell changes and
then run a macro if it does?



1 Answer Found

Answer #1    Answered By: Darwishi Massri     Answered On: Dec 21

right click on the tab of the sheet concerned and click 'view code'.
Enter the following:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("C14").Address Then
MsgBox "code for macro, or call macro  here"
End If
End Sub

This will run  whenever a cell  changes on the sheet, but will bring up
the message box only when cell C14 is changed.

Be aware that some actions which should trigger the event don't, while
some that you think shouldn't do. From J Walkenbach:
Changing the formatting of a cell does not.
Edit|Clear Formats does
Edit|Fill does not, whereas using Autofill does.
Edit|Delete does not. Pressing the Del key does; even if the cell is
already empty.
Data|Form, Data|Sort, Tools|Spelling, Edit|Replace don't.
Changes made by VBA do.

Didn't find what you were looking for? Find more on Excel VBA Check When Cell Has Changed Or get search suggestion and latest updates.