+ Reply to Thread
Results 1 to 7 of 7

GoTo compile error: "Expected: line number or label"

  1. #1
    Registered User
    Join Date
    12-07-2011
    Location
    minneapolis, mn
    MS-Off Ver
    Excel 2007
    Posts
    11

    GoTo compile error: "Expected: line number or label"

    Hello

    The red GoTo pair below are returning the compile error "Expected: line number or label". The only difference I can see between this GoTo and the others I've used is that this GoTo is not nested within an IF statement. I've been searching for information on whether the GoTo command must be nested within some other statement in order to function (when it's not the "On Error GoTo" command), but I haven't been able to turn up any solid information on this.

    Does GoTo have to be nested, or is there something else wrong here? I don't define "Shared" as an argument, function, sub, etc., anywhere else.

    Please Login or Register  to view this content.
    Last edited by elfsprin; 12-29-2011 at 09:22 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: GoTo compile error: "Expected: line number or label"

    "Shared" is apparently a reserved word to VBA; use a different label.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: GoTo compile error: "Expected: line number or label"

    I think shared is a reserved word & cannot be used like thgis. Change it to MyShared

    I'm sure that your cod could be greatly streamlined but without full sight of the code it's hard to advise

    e.g.
    Please Login or Register  to view this content.
    could be
    Please Login or Register  to view this content.
    Edit: had trouble posting this & didn't see shg's reply. Forum doesn't seem to getting any better
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: GoTo compile error: "Expected: line number or label"

    Roy, is it ever going to get better? Have you tried Find all posts by ...

    I know someone who should never be allowed access to a keyboard again.

  5. #5
    Registered User
    Join Date
    12-07-2011
    Location
    minneapolis, mn
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: GoTo compile error: "Expected: line number or label"

    Thanks for the help!

    Also I'm sure you know this already, but just in case: the search forums feature is completely nonfunctional at this time.

    On a different note, I actually would love to get more feedback on how to refine my code. This is my first time writing anything (I don't know any languages, and I've gone from "it takes 30 minutes to figure out how to move and rename my first command button" to my current code in about 25 hours of cumulated work on this), and I am really enjoying it despite the various frustrations I'm encountering with the VBA syntax. Anyway, I'd really like to gather more tips on how to make my code more elegant.

    Is it considered taboo to post code and simply ask "how can this be refined?" If not, I'll do that and see if anyone has the time/inclination to look through it and offer suggestions.

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: GoTo compile error: "Expected: line number or label"

    You can of course post your code & ask for suggestions to improve it

  7. #7
    Registered User
    Join Date
    12-07-2011
    Location
    minneapolis, mn
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: GoTo compile error: "Expected: line number or label"

    Ok, thanks!

+ 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