+ Reply to Thread
Results 1 to 3 of 3

Syntax for formulas using & and ""

Hybrid View

RuthEllen63 Syntax for formulas using &... 11-02-2020, 03:19 PM
Bernie Deitrick Re: Syntax for formulas using... 11-02-2020, 03:45 PM
RuthEllen63 Re: Syntax for formulas using... 11-02-2020, 03:55 PM
  1. #1
    Registered User
    Join Date
    10-30-2020
    Location
    New Providence, PA
    MS-Off Ver
    2016
    Posts
    5

    Syntax for formulas using & and ""

    Hello,

    This line of my code works: Range("M2:M" & lastrow).Formula = "=J2&"": ""&K2"

    This one does not: Range("J" & (row - 1)).Formula = "=L""&(row-1)&Char(10)& ""L"&(row)""

    Clearly I don't understand how to build these formulas and I can't seem to find online examples or tutorials.

    I appreciate your help with this.

    Thanks,

    Ruth

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,263

    Re: Syntax for formulas using & and ""

    Ruth,

    Try this version:

    Range("J" & (row - 1)).Formula = "=L" & (row - 1) & "& Char(10) &" & "L" & (row)
    This is the same, with some simplification of the string manipulation:

    Range("J" & (row - 1)).Formula = "=L" & (row - 1) & "& Char(10) & L" & (row)
    Both concatenate two cells with a return character to get them to wrap within the cell - not sure if that is what you want.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    10-30-2020
    Location
    New Providence, PA
    MS-Off Ver
    2016
    Posts
    5

    Re: Syntax for formulas using & and ""

    They both work!

    Thanks Bernie!

    Ruth

+ 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] syntax error in an "and" in "if" statement in a "for" loop
    By MaartenRo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-22-2020, 08:03 PM
  2. Replies: 5
    Last Post: 02-05-2019, 12:03 AM
  3. [SOLVED] VBA -- Compare two dates and map "Yes" or " No" -- Getting Syntax Error at FormulaR1C1
    By Vinod Krishna.C in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-22-2018, 09:23 AM
  4. Short "Basic" Macro to copy and paste formulas "N" times.
    By gradyhawks in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-09-2014, 02:34 PM
  5. [SOLVED] Count syntax for dividing # of "positive numbers" by "total numbers"
    By synses in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 06-18-2013, 09:06 PM
  6. Recognize "formulas "result" as "typed data", through and through.
    By gandolff in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-13-2009, 01:30 PM
  7. [SOLVED] Syntax to "OR" 3 "ISERROR" conditions
    By Mike K in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-22-2006, 11:25 AM

Tags for this Thread

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