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

Q14.行を挿入するには?

Posted at

エクセルのVBAマクロで行を挿入するにはどうすればいいでしょうか

今回は例として以下のようなエクセルファイルがあるとして、

Q10.png

この4行目に新しく行を挿入する処理を作ってみましょう。

■ポイント

行の挿入は簡単に実装できます。
Rows(挿入したい行).Insertで挿入することができます。

もし、列を挿入したい場合は、
Columns(挿入したい列).Insertとなります。

■回答

Sub Q14_Answer()
    Rows(4).Insert
End Sub

■解説

そのまんまです(笑)
書式設定とかは上のセルのを引き継がれるのでご注意を。

一応結果はこちらです。4行目に新しい行が挿入されているのが分かります。

Q14.png

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?