+ Reply to Thread
Results 1 to 3 of 3

Thread: Inputting a formula which contains Quotes

  1. #1
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    MS 2007
    Posts
    5,372

    Inputting a formula which contains Quotes

    Trying to solve a post here

    http://www.excelforum.com/excel-gene...-to-cells.html

    Seems you can't enter a formula using Range.Formula if the formula contains quotes because VBA sees that quote as the end of the formula. Is there a solution?

    Range("D6").Formula = "=IF(P6=1,P6,IF(H12=O6,1,""))"
    Thanks in advance.
    Last edited by ChemistB; 06-10-2011 at 12:20 PM.
    ChemistB
    My 2¢

    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

  2. #2
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: Inputting a formula which contains Quotes

    I think you need to double-up the quotes for it to work....

    Range("D6").Formula = "=IF(P6=1,P6,IF(H12=O6,1,""""))"
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    MS 2007
    Posts
    5,372

    Re: Inputting a formula which contains Quotes

    Thanks NBVC!
    ChemistB
    My 2¢

    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.2.0