Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
OnChange Event for a Cell
Where do I find the OnChange Event for a cell.
For example Cell A1. I change the value in the cell I would like to perform something. How do I create it or find it? Thank you for your help in advance!!! (smile) Mike |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
OnChange Event for a Cell
Read this
http://www.cpearson.com/excel/events.htm Private Sub Worksheet_Change(ByVal Target As Range) If Not Application.Intersect(Range("a1"), Target) Is Nothing Then MsgBox "you changed A1" End If End Sub Place the code in the Sheet module Right click on a sheet tab and choose view code Paste the code there Alt-Q to go back to Excel -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Michael Kintner" wrote in message ... Where do I find the OnChange Event for a cell. For example Cell A1. I change the value in the cell I would like to perform something. How do I create it or find it? Thank you for your help in advance!!! (smile) Mike |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
OnChange Event for a Cell
Right click on the sheet tab and select view code.
In the left dropdown, select Worksheet and in the right dropdown select Change (dropdowns at top of code module). This puts in a declaration for the change event which is fired whenever a cell is edited or is updated with a DDE link (xl2000 and beyond). In the event, you can use an if statement to see if it was a change to A1 that triggered the event. Target holds a reference to the cell/cells that triggered the event Private Sub Worksheet_Change(ByVal Target As Range) if Target.Address = "$A$1" then code to perform something End if End Sub -- Regards, Tom Ogilvy "Michael Kintner" wrote in message ... Where do I find the OnChange Event for a cell. For example Cell A1. I change the value in the cell I would like to perform something. How do I create it or find it? Thank you for your help in advance!!! (smile) Mike |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
OnChange Event for a Cell
Michael,
Use the Change event procedure. In the code module for the appropriate worksheet, use code like the following: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$A$1" Then Application.EnableEvents = False ' do something here Application.EnableEvents = True End If End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Michael Kintner" wrote in message ... Where do I find the OnChange Event for a cell. For example Cell A1. I change the value in the cell I would like to perform something. How do I create it or find it? Thank you for your help in advance!!! (smile) Mike |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
in vba what command is used to determine if a particular cell on a particular sheet changed? some kind of event? how to get the old and new value of the cell? | Excel Worksheet Functions | |||
OnChange - argh! How do I get this to work please? | Excel Programming | |||
OnTime event not firing in Workbook_Open event procedure | Excel Programming | |||
Inserting time stamp onchange of any cell | Excel Programming | |||
Make cell entry event change another cell? | Excel Programming |