Function when cell is chaged

H

henpat

Good morning/afternoon

I need to execute a function only when the cell "B4" change of value.
How can I do it?
Thanks in advanced
(Office 2003)

henpat
 
M

Maestro!

U¿ytkownik henpat napisa³:
Good morning/afternoon

I need to execute a function only when the cell "B4" change of value.
How can I do it?
Thanks in advanced
(Office 2003)

henpat
Hi,
property EnableEvents have to be true, then you can use Change function
of your worksheet (each worksheet can have different change function).
Example:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo errortrap

Application.EnableEvents = False

If (Target.Column = 2) And (Target.Row = 4) Then
MsgBox ("Cell B4 has been changed")
End If

Application.EnableEvents = True
Exit Sub

errortrap:
Application.EnableEvents = True
Exit Sub
End Sub

Good luck,
Maestro!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top