View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default how to get value of the argument's adjacent cell?

I may be missing something, but surely you would pass the 2 cells to be
worked upon as arguments to that function and use them.

Thus if you wanted to work on B4 and B5 you would cal.l
=myFunction(B4,B5)

To use
=myFun ction(B3,B4)
and offset them seems pervers to me.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Andrew" wrote in message
om...
Hi
I need to write a function which will use two arguments, e.g. vala and
valb (not adjacent) as input values. This function should refer
adjacent cells of vala and valb to calculate result for example:

A B
1 adj_vala vala

2

3 adj_valb valb

4 adj_vala + adj_valb

So UDF to calculate B4, as I see it, will lool like (I don't know how
to get adj_vala and adj_valb in the UDF below):

Function Result(vala As Long, valb As Long) As Long

Dim adj_vala As Long
Dim adj_valb As Long


' get value of the left adjacent cell of vala
adj_vala = ???

' get value of the left adjacent cell of valb
adj_valb = ???

Result = adj_vala + adj_valb

End Function


The example above describes simplifed version of more complex logic I
have to implement, but idea will be the same...

Thanks a lot,
Andrew