VBA pasteFormats激活目标工作表 [英] VBA pasteFormats activating the destination worksheet

查看:97
本文介绍了VBA pasteFormats激活目标工作表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在粘贴列时遇到问题

    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自动激活目标表,以某种方式,我正在尝试避免这种情况.有什么想法吗?

The problem is VBA activating the destination sheet automatically, Somehow, I am trying to avoid it. Any ideas?

谢谢.

推荐答案

您可以尝试执行以下操作:

You can try something like this:

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

评论后

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

这篇关于VBA pasteFormats激活目标工作表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆