search box in blank worksheet, display results from other sheets in workbook

citogrid

New Member
Joined
Mar 16, 2019
Messages
5
hi,
Obvious newbie question: I'm working with a fairly large list of information, not very complex, but spread over 50-some worksheets in one workbook. I'd like to create a blank worksheet with a simple searchbox and a simple button to click.

The results of the search should be displayed just below the searchbox.


Any help would be greatly appreciated.
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Hi,

You could test following macro to Search All Sheets :

Code:
[COLOR=#252C2F][FONT=Courier]Sub SearchAllSheets()
' Author : Dave Hawley
[/FONT][/COLOR][COLOR=#252C2F][FONT=Courier]Dim ws As Worksheet
[/FONT][/COLOR][COLOR=#252C2F][FONT=Courier]Dim rFound As Range
[/FONT][/COLOR][COLOR=#252C2F][FONT=Courier]Dim strName As String
[/FONT][/COLOR][COLOR=#252C2F][FONT=Courier]    On Error Resume Next
[/FONT][/COLOR][COLOR=#252C2F][FONT=Courier]    strName = InputBox("What Name?")
[/FONT][/COLOR][COLOR=#252C2F][FONT=Courier]    If strName = "" Then Exit Sub
[/FONT][/COLOR][COLOR=#252C2F][FONT=Courier]    For Each ws In Worksheets
[/FONT][/COLOR][COLOR=#252C2F][FONT=Courier]        With ws.UsedRange
[/FONT][/COLOR][COLOR=#252C2F][FONT=Courier]           Set rFound = .Find(What:=strName, After:=.Cells(1, 1), LookIn:=xlValues, LookAt:=xlWhole)
[/FONT][/COLOR][COLOR=#252C2F][FONT=Courier]               If Not rFound Is Nothing Then
[/FONT][/COLOR][COLOR=#252C2F][FONT=Courier]                  Application.Goto rFound, True
[/FONT][/COLOR][COLOR=#252C2F][FONT=Courier]                  Exit Sub
[/FONT][/COLOR][COLOR=#252C2F][FONT=Courier]               End If
[/FONT][/COLOR][COLOR=#252C2F][FONT=Courier]        End With
[/FONT][/COLOR][COLOR=#252C2F][FONT=Courier]     Next ws
[/FONT][/COLOR][COLOR=#252C2F][FONT=Courier]     On Error GoTo 0
[/FONT][/COLOR][COLOR=#252C2F][FONT=Courier]     MsgBox "Value not found"
[/FONT][/COLOR][COLOR=#252C2F][FONT=Courier]End Sub
[/FONT][/COLOR]

Hope this will help
 
Upvote 0
Hi James,
Thanks for your help, points me in the right direction. Tested on mac excel, older version, older computer,... macros seem to cause some trouble, at times crashing (not caused by your code but generally not liking macros in excel I guess).

Will test on pc this week :-)

thanks again,

Ben
 
Upvote 0
You are welcome ...

Hope solution will be operational on your PC ... :smile:
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top