#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default UDFs

I apologize for the naive question but I cannot seem to find documentation
(even on McRitchie's) on how to create a User Defined Function with a return
value. Pls complete the following code...

Public Sub aaaaa

if itemcheck()=true then
msgbox("ok")
else
msgbox("not ok")
endif

Public function itemcheck

if blahblah=soso then
return_value=true
else
return_value=false
endif

end function

What do I have to add to the function so that it defines the return_value
and returns it to the calling subroutine;

Thanks for your patience

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default UDFs

Public function itemcheck

if blahblah=soso then
itemcheck=true
else
itemcheck=false
endif

end function

Regards,
Stefi


€˛DoctorG€¯ ezt Ć*rta:

I apologize for the naive question but I cannot seem to find documentation
(even on McRitchie's) on how to create a User Defined Function with a return
value. Pls complete the following code...

Public Sub aaaaa

if itemcheck()=true then
msgbox("ok")
else
msgbox("not ok")
endif

Public function itemcheck

if blahblah=soso then
return_value=true
else
return_value=false
endif

end function

What do I have to add to the function so that it defines the return_value
and returns it to the calling subroutine;

Thanks for your patience

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default UDFs

One of the not so nice things in VB (IMO). The function name is the return
value, so in your case you must add

itemcheck=return_value

or code it to set that inline.


--
HTH

Bob Phillips

"DoctorG" wrote in message
...
I apologize for the naive question but I cannot seem to find documentation
(even on McRitchie's) on how to create a User Defined Function with a

return
value. Pls complete the following code...

Public Sub aaaaa

if itemcheck()=true then
msgbox("ok")
else
msgbox("not ok")
endif

Public function itemcheck

if blahblah=soso then
return_value=true
else
return_value=false
endif

end function

What do I have to add to the function so that it defines the return_value
and returns it to the calling subroutine;

Thanks for your patience



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default UDFs

Thank you both!!
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help and description for UDFs [email protected] Excel Worksheet Functions 0 March 13th 07 05:05 AM
VBA, UDFs and VSTO Terence Craig Excel Programming 3 October 25th 04 07:57 AM
UDFs: A simple question. Mike Mertes Excel Programming 3 July 31st 04 10:27 AM
'portable' UDFs??? whelanj[_7_] Excel Programming 1 July 9th 04 01:13 PM
Acrobat 6.0 and UDFs Mike Lee[_2_] Excel Programming 0 January 29th 04 04:07 PM


All times are GMT +1. The time now is 12:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"