Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Search for worksheet name in Excel spreadsheet
I am trying to find the best way to search for a particular worksheet name
in the spreadsheet that has many worksheets in the file (search in opened spreadsheet). Search result need move me in to appropriate worksheet. Some worksheet in that workbook may have the same name, marked with 1, 2, 3.. like Name-1, Name-2, Name-3.. or Name1, Name2, etc I appreciate any help and code samples. Regards, S. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Search for worksheet name in Excel spreadsheet
Try something like this:
Dim myWB As Workbook Dim myWS As Worksheet Set myWS = Nothing On Error Resume Next Set myWS = Worksheets("Name-1") On Error GoTo 0 If Not myWS Is Nothing Then MsgBox ("You've found your worksheet.") Else MsgBox ("You haven't found your worksheet") End If -- HTH, Barb Reinhardt "SANTANDER" wrote: I am trying to find the best way to search for a particular worksheet name in the spreadsheet that has many worksheets in the file (search in opened spreadsheet). Search result need move me in to appropriate worksheet. Some worksheet in that workbook may have the same name, marked with 1, 2, 3.. like Name-1, Name-2, Name-3.. or Name1, Name2, etc I appreciate any help and code samples. Regards, S. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Search for worksheet name in Excel spreadsheet
On Oct 25, 3:11 pm, "SANTANDER" wrote:
I am trying to find the best way to search for a particular worksheet name in the spreadsheet that has many worksheets in the file (search in opened spreadsheet). Search result need move me in to appropriate worksheet. Some worksheet in that workbook may have the same name, marked with 1, 2, 3.. like Name-1, Name-2, Name-3.. or Name1, Name2, etc I appreciate any help and code samples. Regards, S. Hi Activeworkbook.Worksheets("Name1").Activate will activate the sheet called "Name1" If the workbook is open but not necessarily active then Workbooks("Myworkbook).Worksheets("Name1").Activat e will do it. It would be easy to populate a drop down menu with worksheet names for users to pick from, if that is what you want? regards Paul |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Search for worksheet name in Excel spreadsheet
wrote in message ups.com... On Oct 25, 3:11 pm, "SANTANDER" wrote: I am trying to find the best way to search for a particular worksheet name in the spreadsheet that has many worksheets in the file (search in opened spreadsheet). Search result need move me in to appropriate worksheet. Some worksheet in that workbook may have the same name, marked with 1, 2, 3.. like Name-1, Name-2, Name-3.. or Name1, Name2, etc I appreciate any help and code samples. Regards, S. ------------ Hi Activeworkbook.Worksheets("Name1").Activate will activate the sheet called "Name1" If the workbook is open but not necessarily active then Workbooks("Myworkbook).Worksheets("Name1").Activat e will do it. It would be easy to populate a drop down menu with worksheet names for users to pick from, if that is what you want? regards Paul ------------- Yes, populating a drop down menu with worksheet names for users to pick from(when this required only, not constantly) may be an option. How should look this code and where it goes - inside Module1? Does this code will count newly added worksheet also? Regards, Santander |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Search for worksheet name in Excel spreadsheet
Sub FindSheet()
Dim i As Integer Name = InputBox("Please Enter the Name of the Worksheet to Find", "SheetSearch", vbOKOnly) For i = 1 To Worksheets.Count If Application.ActiveWorkbook.Sheets(i).Name = Name Then Application.ActiveWorkbook.Sheets(i).Select End If Next End Sub Try this one |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Search for worksheet name in Excel spreadsheet
"Valli" wrote in message oups.com... Sub FindSheet() Dim i As Integer Name = InputBox("Please Enter the Name of the Worksheet to Find", "SheetSearch", vbOKOnly) For i = 1 To Worksheets.Count If Application.ActiveWorkbook.Sheets(i).Name = Name Then Application.ActiveWorkbook.Sheets(i).Select End If Next End Sub Try this one ------- Tried, not work. when type name in input box and run, stay with no changes. The main idea is make searching for worksheet name in spreadsheet much more handy than gives us built-in Excel tool 'Find and Replace' that can easily search within Sheet and Workbook, by Rows or by Column. As i understand, custom search need be more handy and more simple compare with built-in one. Regards, S. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
search word or text in excel spreadsheet | Excel Discussion (Misc queries) | |||
Search Spreadsheet - Results in either listbox or new spreadsheet | Excel Programming | |||
A Search Engine inside Excel Spreadsheet | Excel Discussion (Misc queries) | |||
how do i do a search in a spreadsheet thas has multiple worksheet | Excel Discussion (Misc queries) | |||
Create a search Field within a worksheet to search command buttons | Excel Programming |