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

citogrid

New Member
Joined
Mar 16, 2019
Messages
2
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.
 

Some videos you may like

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

James006

Well-known Member
Joined
Apr 4, 2009
Messages
3,680
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
 

citogrid

New Member
Joined
Mar 16, 2019
Messages
2
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
 

James006

Well-known Member
Joined
Apr 4, 2009
Messages
3,680
You are welcome ...

Hope solution will be operational on your PC ... :)
 

Watch MrExcel Video

Forum statistics

Threads
1,109,350
Messages
5,528,191
Members
409,807
Latest member
nicky736

This Week's Hot Topics

  • Change military grades into rank
    Afternoon all Need help with formula that will change military rank (i.e. 1, 2, 3 into Amn, A1C, SrA). Running IF formula that does not work...
  • VBA COUNTIF SOLUTION
    Hi The following are the errors spread across the several columns from E to Q ie. 13 columns across several sheets with more than 500 rows per...
  • INSERT ROW WITH SPECIFIS TEXT IN A COLUMN
    Hi All! How can identify that that the row to be inserted has to be inserted before 1st row with specific text in column F. If I record the...
  • Auto-Create a monthly Sign in sheet for preschool students
    The image below is what each page looks like. Above is space for the "Child Name" "Month" "Class" School days are obviously Monday-Friday but...
  • VBA vlookup multiple results
    Hi folks, Hopefully someone out there can help. I have a list to vlookup which works (ish). the lookup only picks up the first instance of the...
  • Extract values for earliest/latest times
    I am trying to put together a formula to get the earliest start time, the latest end time from column A for each person in Column B-F without the...
Top