Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Event procedure for change of a particular cell?

Does anyone know of an event procedure (or code) that would enable a
piece of code to run upon the change of a particular cell on a
worksheet?

(I know there are event procedures for upon close, upon change, upon
calculate, etc but I only want to execute a piece of code when a
particular cell on my worksheet changes.).

Thanks,
Chet

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Event procedure for change of a particular cell?

The events you are looking for are in the individual sheets. The Open,
Close, etc. are in ThisWorkbook. Double-click the sheet you want, e.g.
"Sheet1" in the VBAProject--Microsoft Excel Objects folder.

"Chet" wrote:

Does anyone know of an event procedure (or code) that would enable a
piece of code to run upon the change of a particular cell on a
worksheet?

(I know there are event procedures for upon close, upon change, upon
calculate, etc but I only want to execute a piece of code when a
particular cell on my worksheet changes.).

Thanks,
Chet


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Event procedure for change of a particular cell?

On the sheet you want to react to the event, right click the tab and select
View Code. Just above the code window are tow drop downs. Change the one on
the left to worksheet. The one on the right will now list all of the events
of the sheet. Select Change. Your code should end up something like this...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$1" Then MsgBox "Tada"
End Sub

--
HTH...

Jim Thomlinson


"Chet" wrote:

Does anyone know of an event procedure (or code) that would enable a
piece of code to run upon the change of a particular cell on a
worksheet?

(I know there are event procedures for upon close, upon change, upon
calculate, etc but I only want to execute a piece of code when a
particular cell on my worksheet changes.).

Thanks,
Chet


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Event procedure for change of a particular cell?

Just a heads up, but

Change < SelectionChange

--
Regards,
Tom Ogilvy


"Jim Thomlinson" wrote:

On the sheet you want to react to the event, right click the tab and select
View Code. Just above the code window are tow drop downs. Change the one on
the left to worksheet. The one on the right will now list all of the events
of the sheet. Select Change. Your code should end up something like this...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$1" Then MsgBox "Tada"
End Sub

--
HTH...

Jim Thomlinson


"Chet" wrote:

Does anyone know of an event procedure (or code) that would enable a
piece of code to run upon the change of a particular cell on a
worksheet?

(I know there are event procedures for upon close, upon change, upon
calculate, etc but I only want to execute a piece of code when a
particular cell on my worksheet changes.).

Thanks,
Chet


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Event procedure for change of a particular cell?

OK thanks. The change would be from editing the cell in question.
Thanks for the ideas..! Chet



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Event procedure for change of a particular cell?

What is the change. Is the cell edited. Is it updated by a DDE formula. Is
it changed by a calculate occuring?

if by editing

right click on the sheet tab and select view code. then put in code like
this:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If Target.Address = "$B$9" Then
MsgBox "B9 has changed"
End If
End If
End Sub

http://www.cpearson.com/excel/events.htm for an overview of events.

--
Regards,
Tom Ogilvy


"Chet" wrote:

Does anyone know of an event procedure (or code) that would enable a
piece of code to run upon the change of a particular cell on a
worksheet?

(I know there are event procedures for upon close, upon change, upon
calculate, etc but I only want to execute a piece of code when a
particular cell on my worksheet changes.).

Thanks,
Chet


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
Validation Procedure with a worksheet change event Bhupinder Rayat Excel Worksheet Functions 2 October 3rd 07 05:18 PM
change event procedure natanz[_2_] Excel Programming 0 November 4th 05 03:42 AM
A procedure should run when one cell switch between false/true - but not with worksheet_calculate or change event... Gunnar Johansson Excel Programming 3 October 19th 04 05:24 PM
change event procedure benb Excel Programming 2 September 24th 04 09:22 PM
Running Event Procedure When Cell Updated on Excel Worksheet Tom Ogilvy Excel Programming 0 August 19th 04 03:38 PM


All times are GMT +1. The time now is 05:29 PM.

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

About Us

"It's about Microsoft Excel"