ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Returning Macro to Starting Cell (https://www.excelbanter.com/excel-worksheet-functions/73822-returning-macro-starting-cell.html)

sony654

Returning Macro to Starting Cell
 
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
--
Sony Luvy

Bob Phillips

Returning Macro to Starting Cell
 
Send the value to ACtivecell.

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"sony654" wrote in message
...
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
--
Sony Luvy




sony654

Returning Macro to Starting Cell
 
Bob - please clarify, how do I send to the ACtivecell? What does that mean?
Thanks
--
Sony Luvy


"Bob Phillips" wrote:

Send the value to ACtivecell.

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"sony654" wrote in message
...
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
--
Sony Luvy





Dave Peterson

Returning Macro to Starting Cell
 
Option explicit
sub test()
Dim ActCell as range

set actcell = activecell

'do your stuff

application.goto actcell

end sub

sony654 wrote:

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
--
Sony Luvy


--

Dave Peterson

Bob Phillips

Returning Macro to Starting Cell
 
Save the activecell like this

Set startCell = Activecell

then at the end of the macro, select it

startCell.Select

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"sony654" wrote in message
...
Bob - please clarify, how do I send to the ACtivecell? What does that

mean?
Thanks
--
Sony Luvy


"Bob Phillips" wrote:

Send the value to ACtivecell.

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"sony654" wrote in message
...
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
--
Sony Luvy








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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com