Excel 2010 VBA Tutorial 33 - Returning Values with a Function

preview_player
Показать описание
How to make a function that will return a value to the calling function
Рекомендации по теме
Комментарии
Автор

These videos save my life, thank you!!

mrmizzarcus
Автор

Simple and clear to the core, thanks.

BellyLaughQuotes
Автор

Hi,

I noticed we don't have to declare a dim for volume to calculate the formula and then have volume equal to the function name "conevolume". We can just have function name conevolume equal the formula directly.

Function conevolume(ByVal radius As Double, ByVal height As Double) As Double

conevolume = WorksheetFunction.Pi * radius ^ 2 * height / 3
End Function

markb
Автор

your tutorials are great! any chance you have the codes you wrote in a document?

samuelsacks
Автор

And when we use byval, if there are two subs and both include the radius and height variables, how do we distinguish which one should be used?

yangyorku
Автор

Yangyorku, he kinda did call the function by typing conevolume(radius, height) that tells the sub givemethenumbers to go out to the function conevolume with radius and height and solve and send back to me.

krn
Автор

how did you call function without writing "call function" in the sub?

yangyorku
Автор

HI!! Thanks for these great  videos!!
I dindt understand why you put the function as double and in the previoud video you didnt.

gloriacaride
Автор

how can you use the function without writing Call before it?

gioxc
Автор

What's the difference between declaring the variables in the function parameters as opposed to inside the function itself?

nomandates
Автор

So that's it?...Just Assign your variable value to the name of the Function and it will return the Value back to the calling function....without any RETURN statement or something like pretty weird in VB code..Ok Understood @_@

indrajeetjaveri