View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Return cursor to previous position

We need to do both:

First insert the module code:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste this stuff in and close the VBE window:

Public r As Range
Public oldr As Range
Sub goback()
If oldr Is Nothing Then
Else
oldr.Select
End If
End Sub


Next insert the worksheet code:

1. right-click the tab name near the bottom of the window
2. select View Code - this brings up a VBE window
3. paste this stuff in and close the VBE window:


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set oldr = r
Set r = Target
End Sub


You can then assign the shortcut to goback.


Note that none of this is necesary if you are navagating a single worksheet
using hyperlinks. You can always return from a hyperlink with the Back
button.
--
Gary''s Student - gsnu200715