繁体   English   中英

VBA pasteFormats激活目标工作表

[英]VBA pasteFormats activating the destination worksheet

我在粘贴列时遇到问题

    Set SourceWBsht = Thisworkbook.Worksheets("Source")
    Set DestinationWBsht= Thisworkbook.Worksheets("Destination")
    SourceWBsht.Range("A1:Z40").EntireColumn.Copy
    DestinationWBsht.Range("A1:Z40").EntireColumn.PasteSpecial  _
    Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False

    SourceWBsht.Range("A1:Z40").EntireRow.Copy
    DestinationWBsht.Range("A1:Z40").EntireRow.PasteSpecial _
    Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False

问题是VBA自动激活目标表,以某种方式,我正试图避免它。 有任何想法吗?

谢谢。

您可以尝试如下操作:

 DestinationWBsht.Range("A1:Z40").value = SourceWBsht.Range("A1:Z40").value

编辑1:评论后

SourceWBsht.Range("A1:Z40").Copy
DestinationWBsht.Range("A1:Z40").PasteSpecial xlPasteFormats
Application.CutCopyMode = False

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM