View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Per Jessen Per Jessen is offline
external usenet poster
 
Posts: 1,533
Default How to retrieve the last selected cell before SelectionChange even

Hi Frank

Here's a way to do it:

Dim LastSelected As String
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Intersect(Target(1, 1), Range("m1:m1")) Is Nothing Then GoTo XIT
MsgBox LastSelected
'...
XIT:
LastSelected = Target.Address
End Sub

Regards,
Per

"Frank Krogh" skrev i meddelelsen
...
I am using the SelectionChange event like this:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target(1, 1), Range("m1:m1")) Is Nothing Then Exit Sub
...
End Sub

My question is if it's a way to retrieve which cell was selected before
the
M1 cell is selected?

Regards

Frank Krogh