+ Reply to Thread
Results 1 to 4 of 4

my code is adding single quotes

  1. #1
    Forum Contributor
    Join Date
    09-19-2004
    Posts
    252

    my code is adding single quotes

    My code here ActiveCell.FormulaR1C1 = "=VLOOKUP(D" & i & ",kickoutrange,6,FALSE)" that's in my macro is adding a formula that looks like this.
    =VLOOKUP('D2',kickoutrange,6,FALSE)"
    when I want it to look like this
    =VLOOKUP(D2,kickoutrange,6,FALSE)"
    why is it adding the single quotes around D2?

  2. #2
    Dave Peterson
    Guest

    Re: my code is adding single quotes

    Try activecell.formula (not .formulaR1C1).

    DKY wrote:
    >
    > My code here ActiveCell.FormulaR1C1 = "=VLOOKUP(D" & i &
    > ",kickoutrange,6,FALSE)" that's in my macro is adding a formula that
    > looks like this.
    > =VLOOKUP('D2',kickoutrange,6,FALSE)"
    > when I want it to look like this
    > =VLOOKUP(D2,kickoutrange,6,FALSE)"
    > why is it adding the single quotes around D2?
    >
    > --
    > DKY
    > ------------------------------------------------------------------------
    > DKY's Profile: http://www.excelforum.com/member.php...o&userid=14515
    > View this thread: http://www.excelforum.com/showthread...hreadid=392663


    --

    Dave Peterson

  3. #3
    KCarhart
    Guest

    Re: my code is adding single quotes

    DKY,
    I've hit this before. You can make the quotes not appear by using
    R1C1-style addressing instead of A1 style. There is information in the
    VBA help about R1C1. It's a tricky line to write and get the
    parentheses and quotes correct.
    Here is an example using EXACT, which I know a little better than
    VLOOKUP

    j = 3
    ActiveCell.FormulaR1C1 = "=EXACT(R[1]C[1],D" & j & ")"

    In the example above, the first parameter uses R1C1 and does not come
    out quoted, and the second uses A1-style, and does come out quoted.

    Note: R[1]C[1] is a relative cell reference, one over and one down from
    the activecell. So there's an extra step if you need absolute.

    Kevin


  4. #4
    Forum Contributor
    Join Date
    09-19-2004
    Posts
    252
    quotes did dissapear by removing the R1C1. I'm not too sure still exactly how to use R1C1 addressing so I just got rid of it. Thanks

+ 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.6.0 RC 1