Results 1 to 3 of 3
  1. #1
    Star Lounger PStepanas's Avatar
    Join Date
    Jan 2001
    Location
    Melbourne, Australia
    Posts
    90
    Thanks
    4
    Thanked 2 Times in 2 Posts

    Function not working -- type problems?

    The trouble with using VBA only rarely is that I never remember its subtleties. The following problem is a symptom of this.

    Basically, of the following two Excel VBA functions, the first always works correctly, while the second always returns #VALUE! (I've removed error checking). The only clue is that Nepn needs to be cast as a parameter to Nep(), so I suspect I don't understand how VBA functions transfer parameters and types with Excel and between themselves. (Rewriting Nepn() as an iterative function doesn't help, either.)

    Function Nep(Series As String, ProdCode As String)

  2. #2
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Function not working -- type problems?

    Paulius,

    A very quick answer to your second question- have a look at Microsoft's Tips for Debugging Visual Basic for Applications Code
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  3. #3
    Star Lounger PStepanas's Avatar
    Join Date
    Jan 2001
    Location
    Melbourne, Australia
    Posts
    90
    Thanks
    4
    Thanked 2 Times in 2 Posts

    Re: Function not working -- type problems?

    Thanks for the pointer to Microsoft's Tips for Debugging Visual Basic for Applications Code. The Debug.Print statement looks most useful.

    The trouble with some of the other recommendations is they don't work terribly well with Excel functions. I guess I could write a macro that calls the function (not a bad thought), but there seems to be some oddities about the Excel/VBA interface that I don't understand and that won't be easily revealed with the suggested techniques.

    Anyone else? [img]/w3timages/icons/smile.gif[/img]

Posting Permissions

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