VBA复制和粘贴方法不工作 [英] VBA Copy and Paste Method Not Working

查看:216
本文介绍了VBA复制和粘贴方法不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个简单的复制和粘贴宏,它可以直到最后一行。当它命中最后一行时,它表示粘贴功能不起作用。我真的很困惑为什么会发生这种情况,并且对此的任何帮助将不胜感激。

I am trying to write a simple copy and paste macro and it works up until the last line. When it hits the last line, it says the paste function will not work. I am really confused why this is happening and any help on this would be greatly appreciated.

Sheet2.Columns("A:B").Insert Shift:=xlToRight
Sheet2.Columns("F:G").Cut
Sheet2.Activate
Columns("A:B").Select
ActiveSheet.Paste
Sheets("SourceData").Columns("A:B").Insert Shift:=xlToRight
Sheets("SourceData").Activate
Columns("A:B").Select
ActiveSheet.Paste                   <-LINE THAT THROWS ERROR

我的错误信息是工作表类的粘贴方法失败

推荐答案

或复制)命令与您的第二个Activesheet.Paste命令

you need a second cut (or copy) command to go with your second Activesheet.Paste command

这篇关于VBA复制和粘贴方法不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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