looping questions

  • Thread starter Thread starter kimt
  • Start date Start date
K

kimt

Afternoon all;

I know this is going to try some of your sense's of humor with m
(sorry Bob), but I am trying to make the following macro loop until th
value of cell "H1" = 0, I have tried several different codes and canno
seem to make it work. Any help will be appreaciated.

Thanks



Private Sub testpb()
'
' testpb Macro
' Macro recorded 03/26/04 by Kim
'


ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1, Copies:=1
Collate _
:=True
Range("I2:K100").Select
Selection.Copy
Range("I1").Select
ActiveSheet.Past
 
You'll be waiting forever for H1 to become 0 because your code does not
alter it.

Maybe you could tell us what you're trying to achieve here so we can further
assist?


Private Sub test()
Do Until Range("H1").Value = 0
'do stuff here
Loop
End Sub
 
Based on what you show

Sub Tester1()
Dim Hell As Boolean
Const Freezes_Over As Boolean = True
Hell = False
Do Until Hell = Freezes_Over
ActiveWindow.SelectedSheets.PrintOut _
From:=1, To:=1, Copies:=1, Collate _
:=True
Range("I2:K100").Select
Selection.Copy
Range("I1").Select
ActiveSheet.Paste
If Not IsEmpty(Range("H1")) Then
If Range("H1") = 0 Then Hell = Freezes_Over
End If
Loop

End Sub
 
It works perfect. For reference H1 is actually a count cell tha
reduces by -1 during each loop. When it gets to 0, there are no mor
time cards to be printed.

Thanks

Ki
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top