Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 147
Default Fire Event only when Cell Change?

I had some code that I was working with the other day that would fire an
event only when the contents of the cell changed, any ideas? I'm currently
using the Worksheet_SelectionChange() but it fires every time I leave a cell
not only when the contents are changed.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default Fire Event only when Cell Change?

Hi

use Worksheet_Change

check out http://www.cpearson.com/excel/events.htm for more info

--
Cheers
JulieD
check out www.hcts.net.au/tipsandtricks.htm
....well i'm working on it anyway
"HotRod" wrote in message
...
I had some code that I was working with the other day that would fire an
event only when the contents of the cell changed, any ideas? I'm currently
using the Worksheet_SelectionChange() but it fires every time I leave a
cell not only when the contents are changed.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Fire Event only when Cell Change?

Don't use the SelectionChange event. Use the Change event.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"HotRod" wrote in message
...
I had some code that I was working with the other day that would
fire an event only when the contents of the cell changed, any
ideas? I'm currently using the Worksheet_SelectionChange() but
it fires every time I leave a cell not only when the contents
are changed.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 147
Default Fire Event only when Cell Change?

How come these EVENTS aren't listed in the drop down lists?

By the way it was

Sub Worksheet_Change(ByVal Target As Range)

that I was thinking of.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Fire Event only when Cell Change?

They are listed in the dropdowns for the class modules where they are
defined.

--
Regards,
Tom Ogilvy

"HotRod" wrote in message
...
How come these EVENTS aren't listed in the drop down lists?

By the way it was

Sub Worksheet_Change(ByVal Target As Range)

that I was thinking of.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Fire Event only when Cell Change?

They are listed in the drop down. Change the left drop down from
"(General)" to "Worksheet", and the worksheet events are listed
in the right side drop down.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"HotRod" wrote in message
...
How come these EVENTS aren't listed in the drop down lists?

By the way it was

Sub Worksheet_Change(ByVal Target As Range)

that I was thinking of.



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 147
Default Fire Event only when Cell Change?

In the code when I fire the Worksheet_SelectionChange() Event I then
reformat the contents of a cell, this in turn re-fires the Event producing
an infinite loop. Is there something I can do, or do I need to create a
global variable to track this problem?


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Fire Event only when Cell Change?

You need to learn how to program without selecting

Instead of

Range("A1").Select
Selection.Numberformat = "#,##0.00"

do

Range("A1").Numberformat = "#,##0.00"

no selection performed; no event triggered.

--
Regards.
Tom Ogilvy

"HotRod" wrote in message
...
In the code when I fire the Worksheet_SelectionChange() Event I then
reformat the contents of a cell, this in turn re-fires the Event producing
an infinite loop. Is there something I can do, or do I need to create a
global variable to track this problem?




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
Fire Macro from Cell Change Slashman Excel Worksheet Functions 7 October 17th 06 04:08 AM
Event doesn't fire Frank Xia Excel Discussion (Misc queries) 6 February 11th 06 12:54 AM
Workbook Open Event does not fire Jon Somerset Excel Programming 1 October 15th 04 12:49 PM
Event class doesn't fire in embedded VBA Tornados[_5_] Excel Programming 0 September 28th 04 03:27 PM
How do I get Pivot filter change event to fire? Claude Excel Programming 4 August 15th 03 10:24 PM


All times are GMT +1. The time now is 08:07 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"