hi everyone,
I am having trouble with the code below. After the first loop (i.e, after the first iteration) i get a message box saying "Code execution has been interrupted" with buttons Continue, Debug, End, and Help below the message. Hitting continue makes it resume the loop but that defeats the whole purpose as I have to do this for every record.
I suspect this has something to do with the PrintOut method but can't figure out what is it. The code is interrupted after the print and when I hit Debug it highlights the "Loop" line. What's going on here?
Any suggestions would be appreciated.
-Natan
Sub PrintCalcSheets()
Dim counter As Integer
counter = 1
Do While counter < 4
Sheets("Benefit calc").Cells(2, 15).Value = counter
Call Macro3
Sheets("Benefit calc").Select
Selection.Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
counter = counter + 1
Loop
End Sub
I am having trouble with the code below. After the first loop (i.e, after the first iteration) i get a message box saying "Code execution has been interrupted" with buttons Continue, Debug, End, and Help below the message. Hitting continue makes it resume the loop but that defeats the whole purpose as I have to do this for every record.
I suspect this has something to do with the PrintOut method but can't figure out what is it. The code is interrupted after the print and when I hit Debug it highlights the "Loop" line. What's going on here?
Any suggestions would be appreciated.
-Natan
Sub PrintCalcSheets()
Dim counter As Integer
counter = 1
Do While counter < 4
Sheets("Benefit calc").Cells(2, 15).Value = counter
Call Macro3
Sheets("Benefit calc").Select
Selection.Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
counter = counter + 1
Loop
End Sub