Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default How to return to worksheet where macro started?

I have a macro that turns off screen updating and then proceeds to jump
around to different worksheets to copy/paste/change some cells. At the end of
this macro process, before I turn screen updating back on, I want to return
to the cell/worksheet that I was on when I started started the macro running.
This is not always the same cell/worksheet and I can't seem to find how one
would do this. Any suggestions?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default How to return to worksheet where macro started?

Hello

If I inderstande your question :

Before the traitement you declare an objet range

MyRange = activesheet.select

And, after the traitement you reposituonne the selection
MyRange.parent.parent.activate
MyRange.parent.select
MyRange.select

or, something almost

J a c q u e s

"Bob Arnett" a écrit dans le message
de ...
I have a macro that turns off screen updating and then proceeds to jump
around to different worksheets to copy/paste/change some cells. At the end
of
this macro process, before I turn screen updating back on, I want to
return
to the cell/worksheet that I was on when I started started the macro
running.
This is not always the same cell/worksheet and I can't seem to find how
one
would do this. Any suggestions?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to return to worksheet where macro started?

My suggestion is to not jump all around in the first place. It is almost
never required to select worksheets and cells to affect changes to them via
VBA. However, you did not post your code so it is a little hard for any of
us to show you how to avoid it in your particular situation.

Rick


"Bob Arnett" wrote in message
...
I have a macro that turns off screen updating and then proceeds to jump
around to different worksheets to copy/paste/change some cells. At the end
of
this macro process, before I turn screen updating back on, I want to
return
to the cell/worksheet that I was on when I started started the macro
running.
This is not always the same cell/worksheet and I can't seem to find how
one
would do this. Any suggestions?


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 421
Default How to return to worksheet where macro started?

Hi Bob,

As already indicated by Rick, it is rarely
necessary, or efficient to select objects;
normally it is preferable to manipulate
relevant object variables.

That said, one approach might be:

'=========
Public Sub Tester()
Dim rngOriginal As Range
Dim rCellOriginal As Range

Set rngOriginal = Selection
Set rCellOriginal = ActiveCell

' Your code

Application.Goto rngOriginal
rCellOriginal.Activate
End Sub
'<<=========



---
Regards.
Norman


"Bob Arnett" wrote in message
...
I have a macro that turns off screen updating and then proceeds to jump
around to different worksheets to copy/paste/change some cells. At the end
of
this macro process, before I turn screen updating back on, I want to
return
to the cell/worksheet that I was on when I started started the macro
running.
This is not always the same cell/worksheet and I can't seem to find how
one
would do this. Any suggestions?


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
How to get Started with macro? Sherees Excel Discussion (Misc queries) 2 December 12th 09 01:10 AM
Relative return to original worksheet in middle of macro [email protected] Excel Programming 2 June 2nd 06 06:52 PM
Personal macro file will not pull up when excel is started Tigger Setting up and Configuration of Excel 0 April 28th 06 08:48 PM
The myworkbook.xls Auto_Open() macro won't run if started by a VBS CRayF Excel Programming 5 September 15th 05 06:37 AM
Macro to return to previous worksheet gurs Excel Programming 6 October 17th 03 05:09 PM


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