How do I search across multiple sheets

tbehnen

New Member
Joined
Sep 11, 2002
Messages
1
How do I do a vlookup or hlookup across mutliple sheets. Or, how do I use the value in a cell as the name of the sheet when I specify the range in a vlookup?
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Joe Was

MrExcel MVP
Joined
Feb 19, 2002
Messages
7,539
You can use this module code that is user interactive. JSW

Sub myfind()
'Search all sheets for InputBox string.
'Run from Module.
Dim Message, Title, Default, SearchString
Message = "Enter your search string!" ' Set prompt.
Title = "Find ? On all sheets!" ' Set title.
Default = "" ' Set default.
' Display message, title, and default value.
SearchString = InputBox(Message, Title, Default)
Set S = Sheets.Application
For Each S In Application.Sheets
With S.Range("A1:IV65536")
Set F = .Find(SearchString, MatchCase:=True, LookAt:=xlWhole, LookIn:=xlValues)
If F Is Nothing Then
MsgBox "Not Found!"
Else
Location = F.Address
S.Select
Range(Location).Select
Exit For
End If
End With
Next S

End Sub
 

Joel Horowitz

New Member
Joined
Aug 23, 2002
Messages
34
Suppose that Sheet1!A1 contains "Sheet2", and the range you want to vlookup is Sheet2!A1:B10. Then you can do

vlookup(...,indirect(Sheet1!A1& "!A1:B10"),...,...)

If you change the value of Sheet1!A1 to any other sheetname, the vlookup will occur on that other sheet

On 2002-09-12 13:31, tbehnen wrote:
How do I do a vlookup or hlookup across mutliple sheets. Or, how do I use the value in a cell as the name of the sheet when I specify the range in a vlookup?
This message was edited by Joel Horowitz on 2002-09-12 15:18
 

Forum statistics

Threads
1,144,510
Messages
5,724,784
Members
422,579
Latest member
Lekha mohanty

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
Top