G
Guest
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

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