+ Reply to Thread
Results 1 to 7 of 7

VBA Formula Syntax Error

  1. #1
    Registered User
    Join Date
    12-08-2015
    Location
    Birmingham, England
    MS-Off Ver
    2007
    Posts
    44

    VBA Formula Syntax Error

    Hello,

    Could someone help to identify the issue with the below please? It says there is a syntax error. I'm sure it's something simple like an issue with the quotes but I can't seem to get it to work.

    Please Login or Register  to view this content.
    I am trying to get it to appear like this:

    "xxxxxx-xxxxxx","text","text","text","2020/08/17"

    Thanks!

  2. #2
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,414

    Re: VBA Formula Syntax Error

    Hi,

    I think this is what you need:

    Please Login or Register  to view this content.
    GC Excel

    If this post helps, then click the star icon (*) in the bottom left-hand corner of my post to Add reputation.

  3. #3
    Registered User
    Join Date
    12-08-2015
    Location
    Birmingham, England
    MS-Off Ver
    2007
    Posts
    44

    Re: VBA Formula Syntax Error

    I still can't get that to work. How do you write it with .formula too and quotes around each item (yours is missing the start and ending quotes)?
    Last edited by bilbo85; 08-17-2020 at 09:48 PM.

  4. #4
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,414

    Re: VBA Formula Syntax Error

    Oups, my bad.
    this would work:

    Please Login or Register  to view this content.
    one way to do it is to write the formula in a cell, then go in the VBE editor, in the immediate window (CTRL + G) and type debug.print activecell.formula
    this will give you the result of my previous code. The you have do replace all single quote " by double quotes "" and add the starting and ending quotes.

  5. #5
    Registered User
    Join Date
    12-08-2015
    Location
    Birmingham, England
    MS-Off Ver
    2007
    Posts
    44

    Re: VBA Formula Syntax Error

    Thanks for this but now I just get #VALUE error.

    Here is the formula that works when typing directly in the cell. So would I have to replace every single quote here with 2 quotes? I still couldn't get that to work.

    Please Login or Register  to view this content.

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,056

    Re: VBA Formula Syntax Error

    It would be:

    Please Login or Register  to view this content.
    Everyone who confuses correlation and causation ends up dead.

  7. #7
    Registered User
    Join Date
    12-08-2015
    Location
    Birmingham, England
    MS-Off Ver
    2007
    Posts
    44

    Re: VBA Formula Syntax Error

    It worked! Thank you so much!

+ 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] VBA If Match Then formula syntax error
    By spyac in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-27-2020, 10:42 AM
  2. [SOLVED] syntax error in vba formula
    By dmcgov in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-25-2019, 06:59 AM
  3. [SOLVED] Syntax error for If then Else formula
    By robert26 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-13-2019, 02:53 PM
  4. [SOLVED] syntax of array vba formula-error
    By pnnaik in forum Excel General
    Replies: 3
    Last Post: 04-01-2018, 01:55 PM
  5. [SOLVED] ActiveCell.Formula Syntax Error
    By Leipzig in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-24-2013, 12:18 PM
  6. Complex Formula Syntax error
    By Cyd44 in forum Excel General
    Replies: 2
    Last Post: 07-01-2012, 10:35 AM
  7. Error with formula syntax
    By menefist in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-28-2005, 03:42 PM

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