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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top