Results 1 to 4 of 4

Thread: End of Statement Error
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Jun 2019
    Posts
    104
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default End of Statement Error

    Hi all,

    I am using this code right here
    Code:
       ActiveCell.FormulaR1C1 = "=IF(RC[-1]="",IF([-35]<>"",RC[-35],"Misc"),RC[-1]"
    Whenever I go to another line I get an error message that says "Expected:end of statement". I do not know why this keeps happening. It is probably something simple I am just missing. Anyone know why this isn't working?

    Thanks in advance

  2. #2
    MrExcel MVP
    Junior Admin
    Joe4's Avatar
    Join Date
    Aug 2002
    Posts
    50,794
    Post Thanks / Like
    Mentioned
    57 Post(s)
    Tagged
    11 Thread(s)

    Default Re: End of Statement Error

    You do not have the right number of double-quotes.
    With double-quotes being used as both text qualifiers, and literal double-quotes that you want in your formula, it can get quite confusing.
    But there is an easy way to let Excel figure out how many it needs and where.

    Simply turn on your Macro Recorder, and record yourself entering an example of the formula you want somewhere on your sheet.
    Then, stop the Macro Recorder, and view the code it just recorded. That shows you the proper syntax, and you can copy and paste that into your VBA code.
    TIPS FOR FINDING EXCEL SOLUTIONS
    1. Use the built-in Help that comes with Excel/Access
    2. Use the Search functionality on this board
    3. A lot of VBA code can be acquired by using the Macro Recorder.

    "Give a man a fish, feed him for a day. Teach a man to fish, feed him for life!"

  3. #3
    Board Regular
    Join Date
    Jun 2019
    Posts
    104
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: End of Statement Error

    Thanks for the help I got it all worked out!

  4. #4
    MrExcel MVP
    Junior Admin
    Joe4's Avatar
    Join Date
    Aug 2002
    Posts
    50,794
    Post Thanks / Like
    Mentioned
    57 Post(s)
    Tagged
    11 Thread(s)

    Default Re: End of Statement Error

    You are welcome!

    The Macro Recorder is a great little tool for getting snippets of code. Even us "experts" use it!
    TIPS FOR FINDING EXCEL SOLUTIONS
    1. Use the built-in Help that comes with Excel/Access
    2. Use the Search functionality on this board
    3. A lot of VBA code can be acquired by using the Macro Recorder.

    "Give a man a fish, feed him for a day. Teach a man to fish, feed him for life!"

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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