Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 89
Default Return cursor to previous position

I'm using Excel 2000. I'm sure that in earlier versions there was a function
key that returned the cursor to the previous position. I have always
remembered it being or involving the F5 key, but the nearest I can get is a
selection box. The "Help" file offers nothing. Its such a simple function it
has to exist! Can someone help?

I'm looking for this as an alternative because Excel is incapable of
creating a relative range name during a macro. Even clicking the "relative"
option still results in recording an absolute reference to the cell
referenced during macro creation, rather than the keystrokes used to produce
it.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Return cursor to previous position

Hi Kevryl:

You can create this feature within a single sheet:

In worksheet code enter:

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


In a standard module enter:

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


and assign a shortcut like CNTRL+e to goback. As you either click or arrow
around the sheet, CNTRL+e will return you to the previous selection.


REMEMBER: this will work only within a single sheet.
--
Gary''s Student - gsnu200715
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 89
Default Return cursor to previous position

Thanks Gary's Student.

You're speaking a bit above my level. Is this 2 ways of doing the same thing
or do both the worksheet code bit and the standard module bit have to be done?
Where do I go to enter worksheet code? Is that the X symbol to the left of
"File" right click/View code routine?
Standard module: Is that the modules where macros are recorded into? I've
done quite a bit of manipulation in there with amending copied macros.

"Gary''s Student" wrote:

Hi Kevryl:

You can create this feature within a single sheet:

In worksheet code enter:

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


In a standard module enter:

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


and assign a shortcut like CNTRL+e to goback. As you either click or arrow
around the sheet, CNTRL+e will return you to the previous selection.


REMEMBER: this will work only within a single sheet.
--
Gary''s Student - gsnu200715

  #4   Report Post  
Posted to microsoft.public.excel.misc
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
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 89
Default Return cursor to previous position

Thanks Garys Student. Looks easy enough now!
REgards, Kevryl

"Gary''s Student" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
cursor position MarkT Excel Discussion (Misc queries) 5 February 7th 07 01:25 PM
how do you make the cursor position have a color ? Erin Nordan New Users to Excel 1 September 22nd 06 08:15 PM
Position Cursor to same address on another tab SassyLassie Excel Worksheet Functions 0 July 14th 06 05:44 AM
Cursor position saziz Excel Discussion (Misc queries) 2 August 9th 05 08:19 PM
Cursor position? Marc Excel Discussion (Misc queries) 1 March 27th 05 07:09 PM


All times are GMT +1. The time now is 05:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"