Returning Macro to Starting Cell

G

Guest

PROBLEM: How do I run a macro and always have the result return to the
starting cell. Meaning, if the cursor is in cell d3 when I launch the macro,
I want the last
step of the macro to return to d3. Then the next time I run it, it starts in
e3 and returns to e3. Thanks for your help. Sony

I appreciate the responses below, but I do not comprehend. I use macro
recorder to create all my macros. When macro recording, what do I do with
Activecell?

Some responses tell me to send the value to Activecell

Option explicit
sub test()
Dim ActCell as range

set actcell = activecell

'do your stuff

application.goto actcell

end sub
 
D

Dave Peterson

'do your stuff should be all your recorded macro (not including the Sub and End
Sub lines).

Alternatively, if your macro was named: DoItNow

Option explicit
sub test()
Dim ActCell as range

set actcell = activecell

call doitnow

application.goto actcell

end sub

sub doitnow()
'your recorded macro statements
end sub
 
G

Guest

Dave I am sorry but am lost. I just want the macro to end where it starts,
that's all - Thanks

Alternatively, if your macro was named: DoItNow

Option explicit
sub test()
Dim ActCell as range **** What am I supposed to do? ***

set actcell = activecell *** What am I supposed to do? ***

call doitnow *** Should this be in my macro? ***

application.goto actcell *** Should this be in my macro? ***

end sub

sub doitnow()
'your recorded macro statements
end sub
 
D

Dave Peterson

What is the name of your macro?

sub test()
Dim ActCell as range
set actcell = activecell
call doitnow 'change doitnow to the name of your macro
application.goto actcell
end sub


Dave I am sorry but am lost. I just want the macro to end where it starts,
that's all - Thanks

Alternatively, if your macro was named: DoItNow

Option explicit
sub test()
Dim ActCell as range **** What am I supposed to do? ***

set actcell = activecell *** What am I supposed to do? ***

call doitnow *** Should this be in my macro? ***

application.goto actcell *** Should this be in my macro? ***

end sub

sub doitnow()
'your recorded macro statements
end sub
 

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