Leave out quotes when copying from cell

后端 未结 13 918
情话喂你
情话喂你 2020-12-01 04:16

Problem:
When copying a cell from Excel outside of the program, double-quotes are added automatically.

Details:
I\'m using

相关标签:
13条回答
  • 2020-12-01 04:28

    Note:The cause of the quotes is that when data moves from excel to clipboard it is fully complying with CSV standards which include quoting values that include tabs, new lines etc (and double-quote characters are replaced with two double-quote characters )

    So another approach, especially as in OP's case when tabs/new lines are due to the formula, is to use alternate characters for tabs and hard returns. I use ascii Unit Separator =char(31) for tabs and ascii Record Separator =char(30) for new lines.

    Then pasting into text editor will not involve the extra CSV rules and you can do a quick search and replace to convert them back again.

    If the tabs/new lines are embedded in the data, you can do a search and replace in excel to convert them.

    Whether using formula or changing the data, the key to choosing delimiters is never use characters that can be in the actual data. This is why I recommend the low level ascii characters.

    0 讨论(0)
  • 2020-12-01 04:31

    I just had this problem and wrapping each cell with the CLEAN function fixed it for me. That should be relatively easy to do by doing =CLEAN(, selecting your cell, and then autofilling the rest of the column. After I did this, pastes into Notepad or any other program no longer had duplicate quotes.

    0 讨论(0)
  • 2020-12-01 04:35
    • if formula having multi line (means having line break in formula) then copy paste will work in that way
    • if can remove multi line then no quotes will appear while copy paste.
    • else use CLEAN function as said by @greg in previous answer
    0 讨论(0)
  • 2020-12-01 04:39

    To keep line breaks when pasting in notepad, replace this line in the macro:

    strTemp = ActiveCell.Value
    

    by:

    strTemp = Replace(ActiveCell.Value, Chr(10), vbCrLf)
    
    0 讨论(0)
  • 2020-12-01 04:42

    It's also possible to remove these double-quotes by placing your result on the "Clean" function.

    Example:

    =CLEAN("1"&CHAR(9)&"SOME NOTES FOR LINE 1."&CHAR(9)&"2"&CHAR(9)&"SOME NOTES FOR LINE 2.")
    

    The output will be pasted without the double-quotes on other programs such as Notepad++.

    0 讨论(0)
  • 2020-12-01 04:43

    My solution when I hit the quotes issue was to strip carriage returns from the end of my cells' text. Because of these carriage returns (inserted by an external program), Excel was adding quotes to the entire string.

    0 讨论(0)
提交回复
热议问题