如何从excel多细胞复制而不引用重复?

时间:2017-05-18 14:04:35

标签: excel excel-vba vba

当我将其粘贴到任何编辑器中时,引号会出现在结尾和开头,并且内部的引号会重复。

1 个答案:

答案 0 :(得分:0)

创建一个宏并尝试以下代码:

Sub copy()
    'If needed Attach Microsoft Forms 2.0 Library: tools\references\Browse\FM20.DLL
    'Then set a keyboard shortcut to the CopyCells Macro (eg Crtl T)
    Dim objData As New DataObject
    Dim cell As Object
    Dim concat As String
    Dim cellValue As String
    CR = ""
    For Each cell In Selection
    If IsNumeric(cell.Value) Then
        cellValue = LTrim(str(cell.Value))
    Else
    cellValue = cell.Value
    End If
    concat = concat + CR + cellValue
    CR = Chr(13)
    Next
    objData.SetText (concat)
    objData.PutInClipboard 
End Sub
相关问题