is there such an event as cell change

hitch_hiker

Active Member
Joined
Feb 21, 2012
Messages
280
I need to do data manipulation based on a particular cell being changed, I can try to work it on sheet change , but cell change would be a lot easier, if it is possible , please advise correct syntax also best location to put the code
 

Some videos you may like

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
23,559
The usual way to restrict the sheet's change event to particular cells is
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Application.Intersect(Target, Range("C10:C16")) Is Nothing Then
        Rem do stuff
    End If
End Sub
Note that if you copy paste, Target might be more than one cell
 

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
Here's something you can start with..

On the sheet you want to do this action, Right click it's Tab - View code.
Paste the following there.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim MyRange As Range, c As Range
Set MyRange = Intersect(Target, Range("C10:C16"))
If MyRange Is Nothing Then Exit Sub
Application.EnableEvents = False
For Each c In MyRange
    c.Offset(0, 1).Value = "Cell " & c.Address & " was just changed"
Next
Application.EnableEvents = True
End Sub
 

hitch_hiker

Active Member
Joined
Feb 21, 2012
Messages
280
thanks Mike, so it's a sheet change but only if in the range, why the private sub?, does that make a difference.
 

hitch_hiker

Active Member
Joined
Feb 21, 2012
Messages
280
thanks Jon,
I might be biting much more than I can chew, but it's the finishing touch for my project
 

Watch MrExcel Video

Forum statistics

Threads
1,099,330
Messages
5,467,977
Members
406,562
Latest member
tobruk

This Week's Hot Topics

Top