Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Returning to a previous location
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Returning to a previous location
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 wrote in message ... 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Returning to a previous location
Works like a champ! Thanks, Chip.
Steve "Chip Pearson" wrote in message ... 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 wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
3-Color Scale Vlookup for Current Month/Previous/Pre-Previous | Excel Discussion (Misc queries) | |||
Hyperlink or Other Method To Return To Previous Location (Sheet) Possible? | New Users to Excel | |||
Returning To Previous Worksheet - Help with sebastienm's code | Excel Discussion (Misc queries) | |||
shortcut to go to previous location or cell | Excel Discussion (Misc queries) | |||
Finding data in a Range / Returning Cell Location | Excel Programming |