Cell Change

L

Luis

Hello.
I want to run some VBA code when a user changes one cell.
Is it possible to capture the change event on a cell, or
the afterupdate event and run a certain VBA code?
If so, how can i do this? Note, the cell in question can
be anyone on the worksheet.

Thanks.
 
N

Nikos Yannacopoulos

Luis,

The Worksheet_Change event which occurs every time you change something on a
worksheet, will do the job for you. Open the VB editor, select the
particular worksheet in the project explorer and put in the following:

Private Sub Worksheet_Change(ByVal Target As Range)
'Your code
'...
'...
End Sub

HTH,
Nikos
 
S

Simon Lloyd

Just right click the tab at the bottom of your sheet choose view code
change the left hand drop down box to Worksheet and the right t
Change, now between the two lines on your sheet type Call your VB
code

Simo
 
H

Helen Trim

Go to the Visual Basic editor and double click on the
worksheet you need to check on. The code window for the
sheet appears, with 2 drop down lists.

From the first list, Object, select Worksheet. From the
second list, Procedure, select Change. The
Worksheet_Change event appears.

Type your code in the event. To refer to the cell that
has changed, use Target.Address

HTH
Helen
 
Top