I use this macro as a sort of mail merge feature within excel that pulls over data and prints one at a time.
StartRow defines what row to start at and print that first and then it moves onto the next all the way to the EndRow which defines what row I want it to stop at.
My question:
Instead of just moving to the next row, how can I get it to print the first defines row then skip 4 rows print, then skip 4 rows and so on in that fashion until it reaches the defined Endrow?
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
StartRow defines what row to start at and print that first and then it moves onto the next all the way to the EndRow which defines what row I want it to stop at.
My question:
Instead of just moving to the next row, how can I get it to print the first defines row then skip 4 rows print, then skip 4 rows and so on in that fashion until it reaches the defined Endrow?
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