Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
sony654
 
Posts: n/a
Default Returning Macro to Starting Cell

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

--

--
Sony Luvy
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson
 
Posts: n/a
Default Returning Macro to Starting Cell

'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


sony654 wrote:

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

--

--
Sony Luvy


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
sony654
 
Posts: n/a
Default Returning Macro to Starting Cell

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

--
Sony Luvy


"Dave Peterson" wrote:

'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


sony654 wrote:

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

--

--
Sony Luvy


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson
 
Posts: n/a
Default Returning Macro to Starting Cell

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



sony654 wrote:

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

--
Sony Luvy

"Dave Peterson" wrote:

'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


sony654 wrote:

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

--

--
Sony Luvy


--

Dave Peterson


--

Dave Peterson
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
Getting macro to copy to starting cell sony654 Excel Worksheet Functions 3 February 4th 06 07:16 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
Macro help - copy a cell down gjcase Excel Discussion (Misc queries) 3 September 4th 05 05:09 AM
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM
Copy cell format to cell on another worksht and update automatical kevinm Excel Worksheet Functions 21 May 19th 05 11:07 AM


All times are GMT +1. The time now is 01:36 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"