Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Using characters (XL97/WinNT4)

    Morning, all! This should be a quick question - I have an idea I know what the answer is but I can't track it down! I have a line in my code that currently looks like this:

    .Cells(intNStartRow + 6, 5).Formula = "=IF(E11="-","-", ((1+E11/200)^2-1)*100)"

    As you can see, I simply want to place a formula in a cell. The problem is that VBA keeps reading the double quotes that are within the formula and assuming it's supposed to use them instead of type them!

    I'm sure the answer is something to do with repeating the character, or placing a special character in front of it, or something but I just can't pin it down (or find it in the Help!).

    Would someone put me out of my misery, please?!

    Many thanks!
    Beryl M


  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Using characters (XL97/WinNT4)

    To use quotes inside a quoted string, double them. Try
    "=IF(E11=""-"",""-"", ((1+E11/200)^2-1)*100)"

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Using characters (XL97/WinNT4)

    Thanks, Hans. Would you believe I tried tripling them but for some reason I didn't just double them! <img src=/S/bingo.gif border=0 alt=bingo width=15 height=22>
    Beryl M


Posting Permissions

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