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
More than 3 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme