View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
mangesh_yadav[_16_] mangesh_yadav[_16_] is offline
external usenet poster
 
Posts: 1
Default Query between worksheets

use the following piece of code in a module
Function ModLookUp(Lookup_value, Table_array, Col_index_num)

Dim rng As Range
Dim X, Y
Dim j


X = Lookup_value
j = Col_index_num

Set rng = Table_array

For i = 1 To rng.Rows.Count Step 1
If (X = rng.Cells(i, 1)) Then
If (result = "") Then
result = rng.Cells(i, j)
Else
result = result & ", " & rng.Cells(i, j)
End If
End If
Next

ModLookUp = result

End Function

And then use this function in your column two as follows
=ModLookUp(A1,Sheet1!$A$1:$B$5,2)

- Manges

--
Message posted from http://www.ExcelForum.com