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

VBA エクセル 差し込み印刷

Posted at
Option Explicit

'標準モジュールの先頭に記述します。
# If VBA7 Then 'Excel2010以上の場合
    Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As LongPtr)
# Else 'Excel2007以下の場合
    Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
# End If

Sub Print_Out_1_2() 'セルに値を設定しながら印刷する(待ち時間あり)
    '定数
    Const conStart As Long = 1      'リストシートの開始番号
    Const conEnd As Long = 78       'リストシートの終了番号
    Const conStep As Long = 3       '間隔 一枚で何人印刷するかで任意に設定
    Const conCell As String = "Q1"  'セル番地
    Const conWait As Long = 100     '待機時間
    '変数
    Dim i As Long
    With Application
        .ScreenUpdating = False
        With .ActiveSheet.Range(conCell)
            For i = conStart To conEnd Step conStep
                .Value = i
                Call Sleep(conWait)
               ActiveSheet.PrintOut 'ActiveSheet.PrintPreview 'プレビュー
            Next
        End With
        .ScreenUpdating = True
    End With
End Sub


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?