+ Reply to Thread
Results 1 to 8 of 8

Compile/Syntax Error on Earnings Calc

  1. #1
    Registered User
    Join Date
    02-16-2018
    Location
    Lagos
    MS-Off Ver
    MS Office 2016
    Posts
    25

    Compile/Syntax Error on Earnings Calc

    Hello Excel Champions,

    I'm just learning the ropes in VB Scripting. I tried running the script below but I'm getting Compile Error: Syntax error

    Please assist. I've tried what I know so far. What could be wrong?

    Please Login or Register  to view this content.
    Attached Images Attached Images
    Last edited by AliGW; 02-16-2018 at 08:57 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,480

    Re: Compile/Syntax Error on Earnings Calc [HELP]

    Welcome to the forum!

    Unfortunately, your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (I will do it for you THIS TIME ONLY as a courtesy.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    02-16-2018
    Location
    Lagos
    MS-Off Ver
    MS Office 2016
    Posts
    25

    Re: Compile/Syntax Error on Earnings Calc [HELP]

    Oh! My bad.. thank you. Duly noted!

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Compile/Syntax Error on Earnings Calc [HELP]

    Comments in VBA should be using commas "'"

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    01-03-2018
    Location
    Fukuoka, Japan
    MS-Off Ver
    Excel 2013
    Posts
    123

    Re: Compile/Syntax Error on Earnings Calc

    Hi. The problem is that you used an asterisk(*) for comments.
    Excel VBA recognizes an apostrophe at the beginning of the text as a commnet.
    Last edited by yujin; 02-16-2018 at 09:23 AM.

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Compile/Syntax Error on Earnings Calc

    Hmm!
    I meant to say an apostrophe, not comma.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,480

    Re: Compile/Syntax Error on Earnings Calc

    Apostrophe or single quotation mark.

  8. #8
    Registered User
    Join Date
    02-16-2018
    Location
    Lagos
    MS-Off Ver
    MS Office 2016
    Posts
    25

    Re: Compile/Syntax Error on Earnings Calc

    Wow! Thank you so much.. that really helps. Appreciate

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Date String Syntax/Compile Error
    By Craig K. in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-04-2014, 01:37 PM
  2. Excel macro (compile error. syntax error.) error
    By salar_younis in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-06-2014, 06:11 AM
  3. [SOLVED] first timer using VB to cut and paste macro - getting compile error syntax error
    By jopedder in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-24-2013, 11:45 AM
  4. [SOLVED] VBA Compile Syntax Error when trying to introduce variables
    By nironto in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-26-2013, 10:58 AM
  5. [SOLVED] Compile Error: Expected Expression, Syntax Error
    By gjohn282 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-20-2012, 11:28 PM
  6. vba code...compile and syntax error
    By prabhuduraraj09 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-26-2012, 10:56 AM
  7. Syntax Error and Compile Error: Expected Line Number or Label...
    By AnthonyWB in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-31-2011, 09:59 AM
  8. Syntax and compile error.
    By Jim15 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-27-2006, 11:16 AM

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