ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Create a search Field within a worksheet to search command buttons (https://www.excelbanter.com/excel-programming/318976-create-search-field-within-worksheet-search-command-buttons.html)

Ed P[_2_]

Create a search Field within a worksheet to search command buttons
 
I have a Workbook created with a page I refer to as the Table of Contents.
Within this page I have approx. 75 different Command Buttons that redirect to
a worksheet within the workbook. Can anyone tell me how to create a Search
field on this page that will locate and redirect the user to that command
button on the page.
Thank you for your help
Ed

Tom Ogilvy

Create a search Field within a worksheet to search command buttons
 
Possibly:

Dim sh as Worksheet, oleObj as OleObject
SearchString = InputBox("Enter Sheet Name")
if SearchString = "" then exit sub
on Error Resume Next
set sh = Worksheets("SearchString")
On Error goto 0
if sh is nothing then
msgbox "No such sheet"
exit sub
End if

for each oleobj in activesheet.OleObject
if type of oleobj is MSForms.Commandbutton then
if oleObj.Caption = SearchString then
oleObj.Activate
exit for
end if
end if
Next



--
Regards,
Tom Ogilvy


"Ed P" wrote in message
...
I have a Workbook created with a page I refer to as the Table of Contents.
Within this page I have approx. 75 different Command Buttons that redirect

to
a worksheet within the workbook. Can anyone tell me how to create a Search
field on this page that will locate and redirect the user to that command
button on the page.
Thank you for your help
Ed





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

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