Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 921
Default VBA - get result from

Hi,

I am trying to use a function (maybe it is technically a macro - I dont
know)- here is my problem.

The function has 3 "input" variables declared as doubles, and based on these
values the function assigns values to 3 output "variables". The output
variables are declared inside the function - so I just want to get them -
without declaring global variables.

So in the code below I want to get variables "get1 - get3"


Sub MainTest()
Dim get1 As Double
Dim get2 As Double
Dim get3 As Double

Call TestFunct1(1, 2, 3)

End Sub

Sub TestFunct1(X, Y, Z)
Dim var1 As Double
Dim var2 As Double
Dim var3 As Double

var1 = 1 * X
var2 = 2 * Y
var3 = 3 * Z

End Sub

Thanks for your help.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,339
Default VBA - get result from

like ...?

Dim get1 As Double
Dim get2 As Double
Dim get3 As Double

Sub MainTest()

Call TestFunct1(1, 2, 3)

Debug.Print get1
Debug.Print get2
Debug.Print get3


End Sub

Sub TestFunct1(X, Y, Z)

get1 = 1 * X
get2 = 2 * Y
get3 = 3 * Z

End Sub


"Jeff" wrote:

Hi,

I am trying to use a function (maybe it is technically a macro - I dont
know)- here is my problem.

The function has 3 "input" variables declared as doubles, and based on these
values the function assigns values to 3 output "variables". The output
variables are declared inside the function - so I just want to get them -
without declaring global variables.

So in the code below I want to get variables "get1 - get3"


Sub MainTest()
Dim get1 As Double
Dim get2 As Double
Dim get3 As Double

Call TestFunct1(1, 2, 3)

End Sub

Sub TestFunct1(X, Y, Z)
Dim var1 As Double
Dim var2 As Double
Dim var3 As Double

var1 = 1 * X
var2 = 2 * Y
var3 = 3 * Z

End Sub

Thanks for your help.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
excel result return wrong calcuation result garyww Excel Worksheet Functions 1 August 14th 06 11:14 AM
excel result return wrong calcuation result garyww Excel Worksheet Functions 0 August 14th 06 05:02 AM
Advanced formula - Return result & Show Cell Reference of result Irv Excel Worksheet Functions 7 May 6th 06 03:36 AM
Importing result from Access query to Excel but the result only c. Edwin Excel Discussion (Misc queries) 0 March 16th 06 01:36 AM
vlookup based on random result returns incorrect result rickat Excel Worksheet Functions 1 December 6th 05 01:16 PM


All times are GMT +1. The time now is 09:50 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"