ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Switching to a specific worksheet (https://www.excelbanter.com/excel-programming/414298-switching-specific-worksheet.html)

JR[_6_]

Switching to a specific worksheet
 
I'm new to VBA and have a sub that creates a new worksheet with the
name specified in a input box. I would like to switch back to my
original worksheet after the creating the new one and I'm lost. I
would also like to switch to any worksheet just by entering the WS
name in an input box. Appreciate any help.

Thanks

Wigi

Switching to a specific worksheet
 
Something like:


Dim sSheetNameOriginal As String

sSheetNameOriginal = ActiveSheet.Name

'your code

Sheets(sSheetNameOriginal).Select 'to go back



--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"JR" wrote:

I'm new to VBA and have a sub that creates a new worksheet with the
name specified in a input box. I would like to switch back to my
original worksheet after the creating the new one and I'm lost. I
would also like to switch to any worksheet just by entering the WS
name in an input box. Appreciate any help.

Thanks



All times are GMT +1. The time now is 07:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com