View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Paul Lautman Paul Lautman is offline
external usenet poster
 
Posts: 85
Default Can a function return two values?

Instead of using the result of the function, simply pass the parameters by
value

Function GE()
'This is the main function
Dim a as long


call ff(a,station,offset)
GE = elevation(station, offset)

End Function


Function ff( var1, var2, var3)
'Returns station and offset to the main function

var2 = var1 +1
var3 = var1^2+1
End Function


"Anil K." wrote in message
...
Is it possible for a function to return two values to be
used in another function?

Suppose I need a function "ff" to calculate two variables
called "station" and "offset". Is it possible to return
both these variables to be used in another function
called "elevation(station, offset)"?

A very rough algorithm follows -

End Function

Function ff( var as long)
'Returns station and offset to the main function

station = a +1
offset = a^2+1

'How do I return both station and offset?
??
End Function

Function elevation (station as long, offset as long)

elevation = station + offset (for simplicity)

End Function

THANKS IN ADVANCE.