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

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
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
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,213,490
Messages
6,113,956
Members
448,535
Latest member
alrossman

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