How can we return a value from User Defined Function ?
For Eg. we have 2 functions. In Fun1 i am getting 2 values
(a,b) and i am addding those 2 and storing in to another var
(c). Now i want to pass that var(c) to another function
(fun2). What will be the script?

Answer Posted / chivukula.kumar

'Try this Code in Only MS-Excel

'After opened should be press Alt+F11
'select and double click the ThisWoorkbook in VBA Project
leftside of application
' paste this code in that

Private Sub Workbook_Open()
Call add(1000, 20000, c)
Call subb(c, 20000)
End Sub

'Creation of Fun1 and Fun2(add and subb)

Function add(a, b, c)
a = a + b
c = a
MsgBox c
End Function

Function subb(c, d)
sb = c - d
MsgBox sb
End Function

Is This Answer Correct ?    10 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Mention how to assign a date value to a variable?

585


Capture the Unique label changes on google home page for I am feeling lucky button and save those label changes to Notepad Note: Using QTP

1869


Explain the adodb.stream class?

545


How to find the font in qtp. Scenario:After entering the username and passwd you will be navigate into the "welcome:Username" page.Now I want to extarct font for this message.

1738


What aspects of vbscript make it safe so that a web page using vbscript cannot destroy or corrupt information on a user's computer?

576






filter the array values without using filter function?

1655


why do u choose to go for testing why cant for devoloping

1586


how to write validation function for date in vb script

2140


How to declare an array in vbscript?

666


What is the difference between for loop and while loop?

550


Plzzzzzzz can any one tell me which is the best institute in hyderabad for learing VBScript. plz do answer guys its urgent plzzzzzzz. thanks in advance.

1721


How to Import data from a file (file is on the desktop) to the data table

1554


How will you get a subset of a array in vbscript?

585


How are arrays declared in the vbscript language?

537


What is the difference between a dictionary and an array?

577