+ Reply to Thread
Results 1 to 2 of 2

Last Activated Cell

Hybrid View

  1. #1
    Registered User
    Join Date
    07-28-2009
    Location
    Egypt
    MS-Off Ver
    Excel 2003
    Posts
    35

    Last Activated Cell

    Hi All ,

    Suppose i have selected a cell and i copy data from it to another Cell , then i want to go back for the original Cell.

    how to do that ?

  2. #2
    Forum Contributor
    Join Date
    02-23-2006
    Location
    Near London, England
    MS-Off Ver
    Office 2003
    Posts
    770

    Re: Last Activated Cell

    You only get events triggered when you ENTER a cell, not when you exit it, so you would need to keep a history of the cell you were in before the one you were in now.
    Something like this in the 'Sheet' area of the code:

    Dim cell_position(0 To 1) As String
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    cell_position(1) = cell_position(0)
    cell_position(0) = Target.Address
    End Sub
    Sub Go_Back()
        If cell_position(1) <> "" Then
            Range(cell_position(1)).Select
        Else
            MsgBox "No previous cell stored"
        End If
    End Sub
    If you find the response helpful please click the scales in the blue bar above and rate it
    If you don't like the response, don't bother with the scales, they are not for you

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1