ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cell Change (https://www.excelbanter.com/excel-programming/308183-cell-change.html)

luis

Cell Change
 
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.

Nikos Yannacopoulos[_5_]

Cell Change
 
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

"Luis" wrote in message
...
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.




Simon Lloyd[_548_]

Cell Change
 
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

--
Message posted from http://www.ExcelForum.com


Helen Trim[_4_]

Cell Change
 

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





-----Original Message-----
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.
.



All times are GMT +1. The time now is 12:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com