Vlookup multiple sheets

jfjl

New Member
Joined
Mar 5, 2009
Messages
10
hello. anyway i can vlookup to multiple sheets in a workbook ?
thanks in advance !
 
ok one other thing i found..... this post was made on another site... it looks like his vba is close to a solution that you are looking for but may need a tweak... you can try posting the code here and see if someone can fix it for oyu

Greetings to one and all.

I am trying to code a VBA function to use VLOOKUP to return a description based on a part number. The part numbers and descriptions are in another workbook (which has multiple worksheets) from the one where the created function will reside. Here is what I have so far (from somewhere on the net):


Function FindDescription(Look_Value As Variant, Tble_Array As Range, Col_num As Integer, Optional Range_look As Boolean)

Dim wSheet As Worksheet
Dim vFound

On Error Resume Next

For Each wSheet In Workbooks("K:\Data\pndb.xls").Worksheets
With wSheet
Set Tble_Array = .Range(Tble_Array.Address)
vFound = WorksheetFunction.VLookup(Look_Value, Tble_Array, Col_num, Range_look)
End With
If Not IsEmpty(vFound) Then Exit For
Next wSheet

Set Tble_Array = Nothing
FindDescription = vFound
End Function


The file K:\Data\pndb.xls is on a network drive and contains all the information. A local file will contain the FindDescription function and should return a description based on a part number input.

My problem is that the function just returns a zero value instead of the actual description. I am a VBA newbie so maybe I made some error in the code?

Thanks much for any help on this.
 
Upvote 0

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,213,482
Messages
6,113,916
Members
448,533
Latest member
thietbibeboiwasaco

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