View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Cell Change Event

Graham,

Use the Change event instead of the SelectionChange event. The
SelectionChange event occurs whenever a range is selected. Change
occurs when the value is changed, either manually or by VBA code
(but not as the result of a calculation).


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

"Graham" wrote in message
...
I am trying to get a cell change event procedure to make a

calculation with
the data entered in one cell and place that data into another

cell. I am
trying something like the procedure below as an example.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Newrange As Range
Set Newrange = Range("A1")
If Union(Target, Newrange).Address = Newrange.Address Then
Range("B1") = Range("A1") * 2.471
End If
End Sub

The problem is that this works but when I put an entry in cell

A1 I must
leave the cell and return to it before the procedure is

activated and the
calculation is carried out. Is there a way that the procedure

can be
activated whenever the value of A1 is changed. Grateful for any

guidance.

Graham Haughs
Turriff, Scotland