0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

ブック間コピペの罠

Posted at

あるレンジを別ブックにペーストしようとしたときのどん詰まり備忘録です。

OK例

db.Activate
Set copytarget = Range("A1:D32")
copytarget.Copy

newdb.Activate
Range("A1").PasteSpecial xlPasteFormulasAndNumberFormats
Set deletetarget = Range("B2:D32")
deletetarget.Delete

NG例

Set copytarget = Range("A1:D32")
Set deletetarget = Range("B2:D32")

db.Activate
copytarget.Copy
newdb.Activate
Range("A1").PasteSpecial xlPasteFormulasAndNumberFormats
deletetarget.Delete

どうやら、いちいちアクティブ化しないといけないっぽいです。面倒ですねぇ。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?