Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Returning to a previous location

2 views
Skip to first unread message

stev...@comcast.net

unread,
Oct 3, 2003, 5:10:11 PM10/3/03
to
In my workbook I have created some sheets that are used for special
calculations which I have hidden because they are not always needed (and I
don't know how to make a VBA message box that will handle the calculations).
I have managed to open a hidden sheet and close it when done but I wind up
on the last visible sheet and I want to go back where I started. I have
tried numerous ways but without success. Can any one help me out.

TIA Steve H


Chip Pearson

unread,
Oct 3, 2003, 5:47:10 PM10/3/03
to
Steve,

Try something like the following:

Dim SaveTLC As Range
Dim SaveSelection As Range

Sub SaveLocation()
Set SaveTLC = ActiveWindow.VisibleRange(1, 1)
Set SaveSelection = Selection
End Sub
Sub ReturnLocation()
Application.Goto SaveTLC, True
Application.Goto SaveSelection, False
End Sub

Call the SaveLocation procedure prior to executing your code, and then call
ReturnLocation after your code is finished to return to the original
location.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com ch...@cpearson.com


<stev...@comcast.net> wrote in message
news:KaGdnSkj24I...@comcast.com...

stev...@comcast.net

unread,
Oct 3, 2003, 6:37:43 PM10/3/03
to
Works like a champ! Thanks, Chip.

Steve

"Chip Pearson" <ch...@cpearson.com> wrote in message
news:utf6mff...@TK2MSFTNGP11.phx.gbl...

0 new messages