LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Creating a function call from from

Anders
you have defined the function as returning a double yet if either paramenter
is not a number you try to return a string.
I suggest you define the function as returning a variant i.e.:

Public Function anders_test(roof As Variant, tail aAs Variant) as Variant

Fred


"Anders" wrote in message
...
Hi all helpful experts :-).

I would like a form to produce a function call to a home made VBA
function.
I don't want to call the function directly from the form since I want to
be
able later to use all nice internal functions as copy cell, drag drop,
extend
etc.

I have made this silly VBA function in a module:
Public Function anders_test(roof As Variant, tail As Variant) As Double
If IsNumeric(roof) And IsNumeric(tail) Then
anders_test = roof / tail
Else
anders_test = "Invalid input"
End If
End Function

I have made a form with this content under an OK button:
Private Sub cmdOK_Click()
ActiveCell.Value = "=anders_test(b6;b6)"
End Sub

When I try to run this I get the error message 1004, Application-defined
or
object-defined error. If I try to save a normal value in the
activecell.value
like activecell.value = "test", everything works.

Can anyone help me?

Kind regards
Anders



 
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
Is there a do not call function? pokdbz Excel Discussion (Misc queries) 2 December 27th 07 04:00 PM
How do I call this function? vrk1 Excel Programming 1 June 18th 05 01:05 AM
how i can call the function reneabesmer Excel Worksheet Functions 2 May 2nd 05 12:13 PM
call a function from VBA Adam Excel Programming 2 March 15th 05 10:17 AM
Function Call Phil Hageman Excel Programming 4 October 9th 03 04:32 PM


All times are GMT +1. The time now is 06:03 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"