+ Reply to Thread
Results 1 to 7 of 7

Format for Concatenate formula which includes single quotes

  1. #1
    Forum Contributor
    Join Date
    10-16-2010
    Location
    Memphis, TN
    MS-Off Ver
    Excel 2003, 2010
    Posts
    151

    Format for Concatenate formula which includes single quotes

    Greetings All

    I have a formula that I wanted to include in a VBA procedure but it contains a single quote addressing a different tab in the active workbook.

    Please Login or Register  to view this content.
    This is the formula as it sits in the cell, but everything I try to do keeps hanging up. I have tried declaring 'Data Staging'!$A$3 as a variable and using it that way as well, but if that should work, I haven't been able to come up with the correct pattern of quotation marks.

    I would appreciate any help!

    Thanks
    Last edited by jacob@thepenpoint; 10-04-2012 at 03:33 PM.
    Jacob Albers
    Excel 2003 & 2010

  2. #2
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,883

    Re: Format for Concatenate formula which includes single quotes

    Will this work? I know VBA wants a space on each side of the &.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

  3. #3
    Forum Contributor
    Join Date
    10-16-2010
    Location
    Memphis, TN
    MS-Off Ver
    Excel 2003, 2010
    Posts
    151

    Re: Format for Concatenate formula which includes single quotes

    Quote Originally Posted by Jacc View Post
    Will this work? I know VBA wants a space on each side of the &.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    I tried this and I end up with the formula with text refDate instead of the value of refDate. I then went back and checked the value of refDate and it is correct.

  4. #4
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,883

    Re: Format for Concatenate formula which includes single quotes

    I think I misunderstood the problem. I thought you wanted VBA to put this formula in a cell for you, maybe that is wrong?
    Could you post a sample workbook?

  5. #5
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,883

    Re: Format for Concatenate formula which includes single quotes

    I found the problem was in the formatting part. Perhaps that was obvious to everyone but me? Anyway, disregard my local dateformat, the quotemarks are correct here. This works for me.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    10-16-2010
    Location
    Memphis, TN
    MS-Off Ver
    Excel 2003, 2010
    Posts
    151

    Re: Format for Concatenate formula which includes single quotes

    Quote Originally Posted by Jacc View Post
    I found the problem was in the formatting part. Perhaps that was obvious to everyone but me? Anyway, disregard my local dateformat, the quotemarks are correct here. This works for me.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    I don't know why it isn't working for me, but copying your code and pasting it into my macro (then changing the date format) still has it picking up my variable name (refDate) as text.

  7. #7
    Forum Contributor
    Join Date
    10-16-2010
    Location
    Memphis, TN
    MS-Off Ver
    Excel 2003, 2010
    Posts
    151

    Re: Format for Concatenate formula which includes single quotes

    Quote Originally Posted by jacob@thepenpoint View Post
    I don't know why it isn't working for me, but copying your code and pasting it into my macro (then changing the date format) still has it picking up my variable name (refDate) as text.
    It is all in the formatting. I finally played around with the quotation marks and located the correct sequence. In case anyone else needs this solution:

    Please Login or Register  to view this content.
    note there are 3 double quotation marks before and after the variable name. Works like a champ! Thanks for the help, I had nearly given up on this one.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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