Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Brake in a loop

set a counter for number of iteration
use the 'stop' method in the code...

"Einar" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Brake in a loop

Could you give me an example? Im not an expert (yet).

Einar

TomHinkle skrev:

set a counter for number of iteration
use the 'stop' method in the code...

"Einar" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CAN YOU PUT MULTIPLE % BRAKE DOWNS IN 1 CELL Duck Excel Worksheet Functions 3 November 27th 05 07:18 PM
Advancing outer Loop Based on criteria of inner loop ExcelMonkey Excel Programming 1 August 15th 05 05:23 PM
Brake & Move Columns Dale Excel Worksheet Functions 1 June 20th 05 03:43 PM
Problem adding charts using Do-Loop Until loop Chris Bromley[_2_] Excel Programming 2 May 23rd 05 01:31 PM
Password Brake.... Mario Manzano Excel Programming 5 May 28th 04 05:41 PM


All times are GMT +1. The time now is 06:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"