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
Is vbscript a case-sensitive or case-insensitive?
Is vbscript language a case-sensitive language and what does it mean?
Write a vbscript procedure that converts feet to inches. Hint: there are 12 inches in a foot?
What is the purpose of the err object in the vbscript language?
How to capture a runtime error in vbscript?
What is vbscript procedures?
How you can call vbscript functions?
Explain about the asc function?
How can the spaces from the string be removed?
Both Static and dynamic arrays are handled by VB script. Is it true?
What are keywords in the vbscript language?
What is loose binding? Why is it not a good practice to use it?
How to assign a numeric value to a variable?
How will you format a number in percetage format in vbscript?
How can constants be declared in the vbscript language?