1
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 3 years have passed since last update.

【超簡単!】Excelマクロが遅くなるたった1つの理由

Posted at

前置き

なんだかんだいってExcelマクロって超便利!

属人化?部分最適?ブラックボックス化?
多いに結構!!

全体最適できたら誰も苦労しません
事務作業はサクッとマクロ組んで効率化しちゃいましょう〜♪

本題

マクロ組んでいざ実行してみたらなんかおっせーな
ってなったときはこれだけチェックすればたいてい改善されます

ThisWorkbook.Worksheets("Sheet1").Range("A1")

これをこう

Dim ws As Worksheets
Set ws = ThisWorkbook.Worksheets("Sheet1")
ws.Range("A1")

要は、プロパティを連ねない(.を2個以上使わない)こと!

たったこれだけ?!と思うかもしれないが侮るなかれ

次回は実際にマクロを実行した時のメモリ消費と、秒数を比較してみよう

特にループ処理の時に威力を発揮します!

1
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
1
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?