Fire Event only when Cell Change?

H

HotRod

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.
 
H

HotRod

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.
 
C

Chip Pearson

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
 
H

HotRod

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?
 
T

Tom Ogilvy

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top