Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
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? Daniel Excel Worksheet Functions 1 June 23rd 05 07:53 PM
OnChange - argh! How do I get this to work please? mightyginger Excel Programming 1 December 9th 03 12:35 PM
OnTime event not firing in Workbook_Open event procedure GingerTommy Excel Programming 0 September 24th 03 03:18 PM
Inserting time stamp onchange of any cell Mitchell Carey Excel Programming 1 August 8th 03 08:09 AM
Make cell entry event change another cell? Ken[_11_] Excel Programming 2 August 7th 03 02:24 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"