View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
James B. James B. is offline
external usenet poster
 
Posts: 3
Default Multiple Lookup in VBA

Hi

I have created the following generic function which use
Excel Vlookup function to find the exact match. It works
fine however I am trying to create another function
similar to this but which would return multple matches in
an array e.g if their are dupliacets get all exact matches
of the part # with corsponding values. Is it possible &
how.

Function SearchSku(Pno As String, WB As String, Sheet As
String, SCol As Long, GetCol As Long)
Res = ""

Dim wks As Worksheet

Set wks = Workbooks(WB).Sheets(Sheet)
Set r = wks.Range(wks.Cells(1, SCol), wks.Range
("IV60000"))

Res = Application.VLookup(Pno, r, GetCol, False)
If IsError(Res) Then
SearchSku = ""
Else
SearchSku = Res
End If

End Function


Thanks a million

James B.
Xl2K vba