Run Macro on cell exit
Hi
try something like the following:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Oldselection as range
If Intersect(Oldselection, Me.Range("A1")) is not nothing then
'run your code
end if
set oldselection = target
End Sub
--
Regards
Frank Kabel
Frankfurt, Germany
Kelly wrote:
Hi group I am using the Office 2000 package
I am looking ofr a way to run a macro on the exit of a
cell.
Example I want to run the code each time the target leaves
A1
I know you can run a macro each time there is a change of
cell address that is not equal to A1 by using
"Worksheet_SelectionChange"
If Target.Address < A1 Then
Bla Bla Bla
But I would prefer to not run this entire code each time
the cell target changes. Just when it leaves A1
One idea I had was to have part of a code run each time
the address was equal to A1 then just hold until the
address was not equal to A1 and then run. I am not sure
how to do this though.
Make sense? Other ideas?
Kelly
|