+ Reply to Thread
Results 1 to 3 of 3

functions that don't function

  1. #1
    Peter Lipp
    Guest

    functions that don't function

    Hi,

    I am now starting to write my own VBA-UDFs. Amazing effects occur - at least
    they don't fail to amaze me. I have code that should be evaluated, and I do
    set a Breakpoint and initiate recalculation - nothing happens. The cell I
    use for testing contains

    =BruttoKV(H4;I4;J3;K4;L4)

    and the code contains

    Public Function BruttoKV(KVStufe As String, Status As String, Jahr As Long,
    UeberStundenPauschale As Boolean, Anstellung As String) As Currency

    (I tried this without all the "As"ses also). Code not executed - or so it
    seams. The cell then contains #VALUE! (#WERT! in german).
    I put in all types of unmeaningful testcode in the BrutoKV-function, like:

    If KVStufe = "1" Then
    BruttoKV = 120#
    Else
    BruttoKV = 0#
    End If

    and nothing else to be sure to see something - no change. I seem to
    misunderstand something here completely. Any hints to push me in the right
    direction are very much appreciated....

    peter



  2. #2
    Gary''s Student
    Guest

    RE: functions that don't function

    This is only a guess, but try to replace the semi-colons with commas in the
    call in the worksheet.

    =BruttoKV(H4,I4,J3,K4,L4)
    in stead of
    =BruttoKV(H4;I4;J3;K4;L4)

    =
    --
    Gary''s Student


    "Peter Lipp" wrote:

    > Hi,
    >
    > I am now starting to write my own VBA-UDFs. Amazing effects occur - at least
    > they don't fail to amaze me. I have code that should be evaluated, and I do
    > set a Breakpoint and initiate recalculation - nothing happens. The cell I
    > use for testing contains
    >
    > =BruttoKV(H4;I4;J3;K4;L4)
    >
    > and the code contains
    >
    > Public Function BruttoKV(KVStufe As String, Status As String, Jahr As Long,
    > UeberStundenPauschale As Boolean, Anstellung As String) As Currency
    >
    > (I tried this without all the "As"ses also). Code not executed - or so it
    > seams. The cell then contains #VALUE! (#WERT! in german).
    > I put in all types of unmeaningful testcode in the BrutoKV-function, like:
    >
    > If KVStufe = "1" Then
    > BruttoKV = 120#
    > Else
    > BruttoKV = 0#
    > End If
    >
    > and nothing else to be sure to see something - no change. I seem to
    > misunderstand something here completely. Any hints to push me in the right
    > direction are very much appreciated....
    >
    > peter
    >
    >
    >


  3. #3
    Jim Thomlinson
    Guest

    RE: functions that don't function

    To force the function to to re-evalueate you can try using

    application.volitile

    Volitile meand that the function will re-calc every time a calc occures,
    similar to the now function. Just a shot in the dark...
    --
    HTH...

    Jim Thomlinson


    "Peter Lipp" wrote:

    > Hi,
    >
    > I am now starting to write my own VBA-UDFs. Amazing effects occur - at least
    > they don't fail to amaze me. I have code that should be evaluated, and I do
    > set a Breakpoint and initiate recalculation - nothing happens. The cell I
    > use for testing contains
    >
    > =BruttoKV(H4;I4;J3;K4;L4)
    >
    > and the code contains
    >
    > Public Function BruttoKV(KVStufe As String, Status As String, Jahr As Long,
    > UeberStundenPauschale As Boolean, Anstellung As String) As Currency
    >
    > (I tried this without all the "As"ses also). Code not executed - or so it
    > seams. The cell then contains #VALUE! (#WERT! in german).
    > I put in all types of unmeaningful testcode in the BrutoKV-function, like:
    >
    > If KVStufe = "1" Then
    > BruttoKV = 120#
    > Else
    > BruttoKV = 0#
    > End If
    >
    > and nothing else to be sure to see something - no change. I seem to
    > misunderstand something here completely. Any hints to push me in the right
    > direction are very much appreciated....
    >
    > peter
    >
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1