エクセルで、ワードのような差し込み印刷が出来るVBAを紹介します。
雛形にデータを当てはめていくだけなので、一度作成すれば長く使える便利なマクロです。
![](https://ramq-cat.com/wp-content/uploads/2021/01/098912.jpg)
定型の文章を作る時に、宛名だけを変更して印刷できないかな。
![](https://ramq-cat.com/wp-content/uploads/2021/01/084919.jpg)
![](https://ramq-cat.com/wp-content/uploads/2021/01/084919.jpg)
![](https://ramq-cat.com/wp-content/uploads/2021/01/084919.jpg)
郵送などの場合は郵便番号や住所も、それぞれ変更して印刷したいですよね。
![](https://ramq-cat.com/wp-content/uploads/2021/01/098912.jpg)
![](https://ramq-cat.com/wp-content/uploads/2021/01/098912.jpg)
![](https://ramq-cat.com/wp-content/uploads/2021/01/098912.jpg)
いちいち入力しなくても良い方法がないかな。
![](https://ramq-cat.com/wp-content/uploads/2021/01/084919.jpg)
![](https://ramq-cat.com/wp-content/uploads/2021/01/084919.jpg)
![](https://ramq-cat.com/wp-content/uploads/2021/01/084919.jpg)
もちろんありますよ。
リスト化が出来れば、請求書などの表計算が必要なものも宛名ごとに作成することが出来ます。
![](https://ramq-cat.com/wp-content/uploads/2021/01/098912.jpg)
![](https://ramq-cat.com/wp-content/uploads/2021/01/098912.jpg)
![](https://ramq-cat.com/wp-content/uploads/2021/01/098912.jpg)
コピペしてやってみます!
![エクセルマクロ](https://ramq-cat.com/wp-content/uploads/2020/11/1484715_s.jpg)
![エクセルマクロ](https://ramq-cat.com/wp-content/uploads/2020/11/1484715_s.jpg)
エクセルで差し込み印刷をする
シート「リスト」
A列:郵便番号
B列:住所
C列:取引先名
![](https://ramq-cat.com/wp-content/uploads/2020/12/3d48eeb0f7f44dabe2799387da11af36.png)
![](https://ramq-cat.com/wp-content/uploads/2020/12/3d48eeb0f7f44dabe2799387da11af36.png)
シート「ひな型」:定形文書
B1:郵便番号
A2:住所
A3:取引先名
![](https://ramq-cat.com/wp-content/uploads/2020/12/f1efe970cfdfeb37a1e64ccc1ae16ede.png)
![](https://ramq-cat.com/wp-content/uploads/2020/12/f1efe970cfdfeb37a1e64ccc1ae16ede.png)
エクセルで差し込み印刷をするVBA
Sub 差込印刷()
Dim e As Long Dim i As Integer
e = Sheets(“リスト”).Range(“A1”).End(xlDown).Row
Sheets(“ひな型”).Select
For i = 2 To e
With Sheets(“リスト”)
Range(“B1”) = .Cells(i, 1)
Range(“A2”) = .Cells(i, 2)
Range(“A3”) = .Cells(i, 3)
End With
ActiveSheet.PrintOut Next
‘※PrintOut→PrintPreview でブリントビューが開く
End Sub
エクセルで差し込み印刷をするVBAの解説
※イメージ(最初のリストが挿入されたもの)
![](https://ramq-cat.com/wp-content/uploads/2020/12/014fd4054c683f19abe3ec8d6a6a0f5c.png)
![](https://ramq-cat.com/wp-content/uploads/2020/12/014fd4054c683f19abe3ec8d6a6a0f5c.png)
![](https://ramq-cat.com/wp-content/uploads/2021/01/084919.jpg)
![](https://ramq-cat.com/wp-content/uploads/2021/01/084919.jpg)
![](https://ramq-cat.com/wp-content/uploads/2021/01/084919.jpg)
リストとひな型をきちんと作れば、一度にたくさんの書類を「ボタン一つ」で作成可能なのでとても便利で時短になりますよ。
コメント