View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Dave D-C[_3_] Dave D-C[_3_] is offline
external usenet poster
 
Posts: 176
Default Macro for returning to the previously selected cell

I'm kind of using Mark's idea here, but how about:
In ThisWorkbook:

Option Explicit

Dim gNewTarget As Range, gOldTarget As Range

Private Sub Workbook_SheetSelectionChange( _
ByVal Sh As Object, _
ByVal Target As Excel.Range)
Set gOldTarget = gNewTarget
Set gNewTarget = Target
End Sub

Public Sub Goback()
Sheets(gOldTarget.Parent.Name).Activate
gOldTarget.Select
End Sub

Now you still have to connect the shortcut to
the Sub Goback. Dave D-C

Mike C wrote:
Hello - I am trying to figure out how to create a macro that will
allow me to jump to my prior location in a workbook.

For example, I will be in Sheet1:A35, then I will need to go to
Sheet5:D73. What I am trying to do is come up with a shortcut to
immediately jump back to Sheet1:A35.

Does anyone have some code put together that does this?

Thanks for any suggestions!

- F