View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
pm[_2_] pm[_2_] is offline
external usenet poster
 
Posts: 44
Default VBA formula building

Tom Ogilvy wrote:

I had to change x to String so I could pass it a sheet name, but once I did
that and put my workbook in R1C1 mode and entered data in the appropriate
places, it worked for me

=findid("[aa_test.xls]","Sheet1")


now, function looks like this:

Function FindID(c As Variant, x As String)
'c - file
'x - sheet

s = "=INDEX('" & c & x & "'!R8C3:R8C154,1,MATCH(RC3,'" & c & x & "'!R15C3:R15C154,0))"
FindID = Evaluate(s)

End Function

and formula returns #ARG!

arguments c and x are results of formulas in other cells

i use this function in this way:

=findid(C5;B3)

value in C5 (c) is [names_en.xls]
value in B3 (x) is 4