ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Activating a Worksheet? (https://www.excelbanter.com/excel-discussion-misc-queries/121938-activating-worksheet.html)

Kenny R

Activating a Worksheet?
 
WorkbookA has a worksheet with a column of cells listing the names of
worksheets in WorkbookB.

How can I activate the worksheet in B that matches the active cell on the
list in WorkbookA?

Bernie Deitrick

Activating a Worksheet?
 
Kenny,

Run this when WorkbookA is active, with the sheet with the names active, and the selection made:

Sub ActivateSheet()
Dim myShName As String
myShName = Selection(1).Value
Workbooks("WorkbookB.xls").Activate
Worksheets(myShName).Activate
End Sub

HTH,
Bernie
MS Excel MVP


"Kenny R" wrote in message
...
WorkbookA has a worksheet with a column of cells listing the names of
worksheets in WorkbookB.

How can I activate the worksheet in B that matches the active cell on the
list in WorkbookA?




Kenny R

Activating a Worksheet?
 
Thank You very much---worked great...Kenny

"Bernie Deitrick" wrote:

Kenny,

Run this when WorkbookA is active, with the sheet with the names active, and the selection made:

Sub ActivateSheet()
Dim myShName As String
myShName = Selection(1).Value
Workbooks("WorkbookB.xls").Activate
Worksheets(myShName).Activate
End Sub

HTH,
Bernie
MS Excel MVP


"Kenny R" wrote in message
...
WorkbookA has a worksheet with a column of cells listing the names of
worksheets in WorkbookB.

How can I activate the worksheet in B that matches the active cell on the
list in WorkbookA?





Bernie Deitrick

Activating a Worksheet?
 
Kenny,

You're quite welcome... glad to hear that you got it to work.

Bernie
MS Excel MVP


"Kenny R" wrote in message
...
Thank You very much---worked great...Kenny

"Bernie Deitrick" wrote:

Kenny,

Run this when WorkbookA is active, with the sheet with the names active, and the selection made:

Sub ActivateSheet()
Dim myShName As String
myShName = Selection(1).Value
Workbooks("WorkbookB.xls").Activate
Worksheets(myShName).Activate
End Sub

HTH,
Bernie
MS Excel MVP


"Kenny R" wrote in message
...
WorkbookA has a worksheet with a column of cells listing the names of
worksheets in WorkbookB.

How can I activate the worksheet in B that matches the active cell on the
list in WorkbookA?








All times are GMT +1. The time now is 10:28 AM.

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