Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / May 2008

Tip: Looking for answers? Try searching our database.

How to retrieve the last selected cell before SelectionChange even

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Frank Krogh - 30 May 2008 09:04 GMT
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
Per Jessen - 30 May 2008 09:26 GMT
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

>I am using the SelectionChange event like this:
>
[quoted text clipped - 10 lines]
>
> Frank Krogh
Frank Krogh - 30 May 2008 11:20 GMT
Thank you for the solution.

Frank

> Hi Frank
>
[quoted text clipped - 27 lines]
> >
> > Frank Krogh
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.