ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   about udf.. (https://www.excelbanter.com/excel-programming/370378-about-udf.html)

tom taol

about udf..
 


function fnv()
etc.....
fnv="xxxx"
end function

i want to replace fnv to sharing letter in syntex.
namely, if I change function header name only, syntex need not changed.

for example,,,
function fnv(k)

if k=1 then
thisFunction="xxxx"
else
thisFunction="yyy"
endif
end function

i change "fnv" name only. and then execute normally.
for example,replace name fnv to fnv2....

function fnv2(k)

if k=1 then
thisFunction="xxxx"
else
thisFunction="yyy"
endif
end function



*** Sent via Developersdex http://www.developersdex.com ***

Tim Williams

about udf..
 
VBA doesn't support a

Return "xxxxx"

syntax. Why do you need this: is it just for the minor convenience of only changing the one line and not 2 or more?

If the return value is set in multiple places in a function I always use something like:

'*************
Function blah(v) as integer
Dim retVal as integer

if v=1 then
retVal=2
else
retVal=3
end if

blah = retVal
end function
'**************

Tim



"tom taol" wrote in message ...


function fnv()
etc.....
fnv="xxxx"
end function

i want to replace fnv to sharing letter in syntex.
namely, if I change function header name only, syntex need not changed.

for example,,,
function fnv(k)

if k=1 then
thisFunction="xxxx"
else
thisFunction="yyy"
endif
end function

i change "fnv" name only. and then execute normally.
for example,replace name fnv to fnv2....

function fnv2(k)

if k=1 then
thisFunction="xxxx"
else
thisFunction="yyy"
endif
end function



*** Sent via Developersdex http://www.developersdex.com ***





All times are GMT +1. The time now is 01:11 AM.

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