ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How I can create a function with return argument (https://www.excelbanter.com/excel-discussion-misc-queries/209107-how-i-can-create-function-return-argument.html)

pol

How I can create a function with return argument
 
I have a macro program numoffday

Sub offdays()
li_sunday = .Cells(i, 41).Value
int offDays = numoffday(li_sunday)
End Sub

Please let me know how I can create a function numoffday() with integer
return value in Excel macros

Bernard Liengme

How I can create a function with return argument
 
Please tell us in words what you need the function to do
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"pol" wrote in message
...
I have a macro program numoffday

Sub offdays()
li_sunday = .Cells(i, 41).Value
int offDays = numoffday(li_sunday)
End Sub

Please let me know how I can create a function numoffday() with integer
return value in Excel macros




Jim Thomlinson

How I can create a function with return argument
 
Generally a function has the following form...

public function numoffday() as long
numoffday = 12345
end function

I used a long instead of an integer as it is actually more efficient to use
a long on a 32 bit machine...
--
HTH...

Jim Thomlinson


"pol" wrote:

I have a macro program numoffday

Sub offdays()
li_sunday = .Cells(i, 41).Value
int offDays = numoffday(li_sunday)
End Sub

Please let me know how I can create a function numoffday() with integer
return value in Excel macros



All times are GMT +1. The time now is 10:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com