Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Select sheet

Hi,

I am selecting varous sheets thru a userform combobox
based combobox value. How can I store the sheet name
before loading the userform and return to that sheet when
I close the user form with a close button?

Thanks in advance

Abdul
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Select sheet

Abdul,

Try something like

Sub SaveLocation(Optional GoBack As Variant = False)
Static TopLeftCell As Range
Static SelectedCells As Range
If GoBack = False Then
Set TopLeftCell = ActiveWindow.VisibleRange(1, 1)
Set SelectedCells = Selection
Else
Application.Goto TopLeftCell
SelectedCells.Select
End If
End Sub

To save the current location, use

SaveLocation

Then, to return to the location, use
SaveLocation GoBack:=True



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




"Abdul" wrote in message
...
Hi,

I am selecting varous sheets thru a userform combobox
based combobox value. How can I store the sheet name
before loading the userform and return to that sheet when
I close the user form with a close button?

Thanks in advance

Abdul



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
Select pictures from a sheet into an other sheet Pjotr70 Excel Discussion (Misc queries) 5 June 18th 09 01:03 PM
Alternate Row Select in Sheet 1 then Paste to Sheet 2 Steevo Excel Worksheet Functions 4 December 5th 08 06:45 PM
How do I select price from sheet.b where sheet.a part no = sheet.b Sonny Excel Worksheet Functions 4 April 4th 06 05:08 PM
Use Sheet CodeNames to Select Sheet in Different Workbook Randy Excel Discussion (Misc queries) 1 June 10th 05 12:17 AM
Macro, select Sheet "Number", NOT Sheet Name DAA Excel Worksheet Functions 4 November 30th 04 05:29 PM


All times are GMT +1. The time now is 09:50 AM.

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"