Returning cursor to previous position

E

Efto

Is there a way to return cursor to previous position after running a macro? I
will need to execute the macro but without changing the position of the
cursor.
 
H

Helmut Weber

Hi Efto,

basically like this:

Remember where the cursor is,
execute your macro, and go back.

Sub test0098()
Dim rTmp As Range
Set rTmp = Selection.Range
' execute code here or in another macro
rTmp.Select
End Sub

Which doesn't work,
if the original range isn't there anymore, of course.

Or if your code is in the same macro,
and does change rTmp.
 
Top