PDA

View Full Version : Worksheet Change Event



jamilm
12-24-2012, 06:10 AM
Dear Gurus,

i have question, can a macro be run if a particular cell value would be changed?


for instance Cell A2 Value is = Interim Report and if the value is changed to Final Report then a macro should run for instance a msgbox to pop "Text Changed"

would this be possible?


thanks.

LalitPandey87
12-24-2012, 08:34 AM
Step1:- Right click on sheet1 tab and click on View code
Step2:- Paste below code




Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address(0, 0) = "A2" Then
MsgBox "Text changed.", vbInformation, "Text changed message..."
End If

End Sub

jamilm
12-29-2012, 12:06 AM
Pandey,

this was very helpful. you should be MVP of excel. thanks very much. Happy New Year!


Step1:- Right click on sheet1 tab and click on View code
Step2:- Paste below code




Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address(0, 0) = "A2" Then
MsgBox "Text changed.", vbInformation, "Text changed message..."
End If

End Sub