Results 1 to 3 of 3

Thread: Compile Error: Expected: line number or label or statement ....

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Newbie
    Joined
    Dec 2015
    Posts
    2
    Location

    Compile Error: Expected: line number or label or statement ....

    I am trying to write a function in MS Office Excel. I continue to get the following error message when I test the function:

    Compile error: Expected: line number or label or state or end of statement.

    I reduced the function code down to the bare minimum, but keep getting the error.

    Here is the function code:

    Function z() As Variant
    Debug.Print 123
    z = 99
    End Function


    I am testing the function in the immediate window within Excel VBA with the following line:

    =z()

    I would expect to see 123 displayed following the call to the function, instead I am getting the error message above. Any ideas? Could there be a permissions / setup problem?

    Thanks!

    PS using MS Office Standard 2013
    Last edited by forrest; 12-06-2015 at 04:35 PM. Reason: added version of MS Office

Posting Permissions

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