Automating a Printout
Sub Example1()
Dim bFlag as Boolean
Dim cnt as Long
bFlag = False
do
cnt = cnt + 1
if rnd() .995 then
bFlag = True
End if
until bflag = True
Worksheets("sheet2").Printout
msgbox "Number of loops: " & cnt
End Sub
--
Regards,
Tom Ogilvy
"Stella" wrote:
Hi all,
I'm using Excel 2002
From Sheet1 I run a Do Until macro and when it stops I want to print Sheet2
automatically [ the print area is already set].
What do I need to add to the macro between *loop* and *end* to achieve this?
Many thanks
Stella
|