Repare VBA脚本仅复制值

时间:2014-03-19 07:24:28

标签: excel vba excel-vba

如何重新配置​​此VBA脚本以仅复制值

Sub CopyData()
Dim mRng As Range
    Set mRng = Range([b11], [l11])

  If Application.CountA(mRng) = 0 Then
        MsgBox "Nothing to Send!!!"
    Exit Sub

       Else
       xx = MsgBox("ARE YOU SURE?", vbYesNo, "Light26")
    If xx = 6 Then: Selection.ClearContents: Range("D1").Select
    If xx = 7 Then: Exit Sub
            MsgBox "Thank You!!!"

            mRng.Copy Sheets("Sheet2"). _
            Cells(Rows.Count, 1) _
    .End(xlUp).Offset(1, 0)


    End If
 End Sub

1 个答案:

答案 0 :(得分:0)

你应该使用PasteSpecial xlPasteValues

Sub CopyData()
Dim mRng As Range
Set mRng = Range([b11], [l11])

If Application.CountA(mRng) = 0 Then
    MsgBox "Nothing to Send!!!"
Exit Sub

   Else
   xx = MsgBox("ARE YOU SURE?", vbYesNo, "Light26")
If xx = 6 Then: Selection.ClearContents: Range("D1").Select
If xx = 7 Then: Exit Sub
        MsgBox "Thank You!!!"

        mRng.Copy
        Sheets("Sheet2"). _
        Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues


End If
End Sub