ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   search all open workbooks for sheet name (https://www.excelbanter.com/excel-programming/428688-search-all-open-workbooks-sheet-name.html)

J.W. Aldridge

search all open workbooks for sheet name
 
find sheet name "x" in all open workbooks.
go to sheet, cell a1.

Rick Rothstein

search all open workbooks for sheet name
 
Give this code a try...

Sub GotoSheetA1onSheetNamedX()
Dim WB As Workbook
On Error Resume Next
For Each WB In Application.Workbooks
WB.Worksheets("X").Activate
WB.Worksheets("X").Range("A1").Select
Next
End Sub

Change all the X's to the actual name of the sheet you want to go to.

--
Rick (MVP - Excel)


"J.W. Aldridge" wrote in message
...
find sheet name "x" in all open workbooks.
go to sheet, cell a1.



J.W. Aldridge

search all open workbooks for sheet name
 
trying to find workbook with worksheet that has same name. Ending of
name may vary, but starts off as code indicates.
Code doesn't work... any clues?

Sub GotoSheetA1onSheetNamedX()
Dim wb As Workbook
On Error Resume Next
For Each wb In Application.Workbooks
wb.Worksheets("2ndex_to*").Activate
wb.Worksheets("2ndex_to*").Range("A1").Select
Next
End Sub

Rick Rothstein

search all open workbooks for sheet name
 
You have to give us *all* the information regarding your problem in order
for us to give you code that you can use. It is almost always a bad idea to
simplify your examples or needs when you ask questions on newsgroups.

Give this code a try...

Sub GotoSheet()
Dim WB As Workbook
Dim WS As Worksheet
On Error Resume Next
For Each WB In Application.Workbooks
For Each WS In WB.Worksheets
If WS.Name Like "2ndex_to*" Then
WS.Activate
WS.Range("A1").Select
End If
Next
Next
End Sub

--
Rick (MVP - Excel)


"J.W. Aldridge" wrote in message
...
trying to find workbook with worksheet that has same name. Ending of
name may vary, but starts off as code indicates.
Code doesn't work... any clues?

Sub GotoSheetA1onSheetNamedX()
Dim wb As Workbook
On Error Resume Next
For Each wb In Application.Workbooks
wb.Worksheets("2ndex_to*").Activate
wb.Worksheets("2ndex_to*").Range("A1").Select
Next
End Sub



J.W. Aldridge

search all open workbooks for sheet name
 
thanx.


All times are GMT +1. The time now is 07:01 AM.

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