Thread: Brake in a loop
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Einar Einar is offline
external usenet poster
 
Posts: 12
Default Brake in a loop

I have workbook with different prices depending on postal code found in
worksheet €śaddress€ť. Usually we print out more than 100 copies with both
name, address and corresponding price. I want to make a brake in the loop and
verify for every 20th copy.

The question is how?

The macro looks like this:

Sheets("Adress").Select
With Sheets("Adress")
.Range("A12").Copy Sheets("Intern forside").Range("BE14")
.Range("B12").Copy Sheets("Intern forside").Range("BE15")
.Range("C12").Copy Sheets("Intern forside").Range("BE16")
.Range("D12").Copy Sheets("Intern forside").Range("BE17")
.Range("E12").Copy Sheets("Intern forside").Range("BE18")
.Range("F12").Copy Sheets("Intern forside").Range("BE19")
.Range("G12").Copy Sheets("Intern forside").Range("BE20")
.Range("H12").Copy Sheets("Intern forside").Range("BE21")
End With

iEndRow = Sheets("Adress").Cells(Rows.Count, "A") _
.End(xlUp).Row

i = 14

With Sheets("Adress")
For Each cell In Range("A12:H" & iEndRow)
cell.Copy Sheets("Intern").Range("BE" & i)
i = i + 1
If i = 22 Then
Worksheets("Price").PrintOut Copies:=1, Collate:=True
i = 14
End If
Next cell
End With

-------------------

Thanks for help

Einar