This VBA is designed to loop print until all records that I have identified have been printed.
This was designed based on pulling one set of data over. I have now modified it so that 4 sets of data pull over.
My question:
After the first time the doc prints the cell labeled as "StartRow" instead of shifting by 1 digit it shifts by 4, so I am not printing duplicutes.
so the first record that prints is one through four and the second would be 5 through 8 so on and so on.
Sub PrintForms()
Dim StartRow As Integer
Dim EndRow As Integer
Dim Msg As String
Dim i As Integer
Sheets("Form").Activate
StartRow = Range("StartRow")
EndRow = Range("EndRow")
If StartRow > EndRow Then
Msg = "ERROR" & vbCrLf & "The starting row must be less than the ending row!"
MsgBox Msg, vbCritical, APPNAME
End If
For i = StartRow To EndRow
Range("RowIndex") = i
If Range("Preview") Then
ActiveSheet.PrintPreview
Else
ActiveSheet.PrintOut
End If
Next i
End Sub
This was designed based on pulling one set of data over. I have now modified it so that 4 sets of data pull over.
My question:
After the first time the doc prints the cell labeled as "StartRow" instead of shifting by 1 digit it shifts by 4, so I am not printing duplicutes.
so the first record that prints is one through four and the second would be 5 through 8 so on and so on.
Sub PrintForms()
Dim StartRow As Integer
Dim EndRow As Integer
Dim Msg As String
Dim i As Integer
Sheets("Form").Activate
StartRow = Range("StartRow")
EndRow = Range("EndRow")
If StartRow > EndRow Then
Msg = "ERROR" & vbCrLf & "The starting row must be less than the ending row!"
MsgBox Msg, vbCritical, APPNAME
End If
For i = StartRow To EndRow
Range("RowIndex") = i
If Range("Preview") Then
ActiveSheet.PrintPreview
Else
ActiveSheet.PrintOut
End If
Next i
End Sub
Last edited: