View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Run Macro on cell exit

Hi JE
saw the missing Static also :-)

the 'not' part though is a little bit embarassing (should not code
within Outlook Express...9
thanks for the correction!


--
Regards
Frank Kabel
Frankfurt, Germany


JE McGimpsey wrote:
Frank -

OldSelection needs to be either declared as a global variable, or

else
as a static variable.

The "Not" needs to come before Intersect - not requires an expression
that can be evaluated as boolean rather than Nothing.


In article ,
"Frank Kabel" wrote:

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