MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Jan 14th, 2002, 06:52 PM   #1
Lighting
 
Join Date: Apr 2002
Posts: 11
Default

Had to go to work on Sunday to test it out. Couldn't wait till tommorrow.

daleyman, your solution worked, but as some rows got deleted and pagecount changes it still prints 7 pages. I got for example page 7 of 4. So it didn't suite me completly. Thanks anyway.

Jay Petrulis macro was just what I needed. It worked perfectly. Thanks.
Can you please explain what the following means and do?

Dim Pagecount as Integer
Dim PageNumber as Integer
PageCount=ExecuteExcel4Macro("Get.Document(50)")

And I bother you a little more.
Can you please add a code that let me choose how many copies I want to print.
Thanks in advance.

Lighting
Lighting is offline   Reply With Quote
Old Apr 13th, 2002, 06:48 PM   #2
Lighting
 
Join Date: Apr 2002
Posts: 11
Default

Can someone help me with the following?

I have to print an invoice which can change from 1 to 7 pages. I have set a print range and the rows that are empty I just delete them. By doing this the quantity of pages change. I have some repeated rows that have to print on each page.
Now my problem begins. Somewhere in the repeated rows I have to print page # of #.
I am doing this now by changing the numbers manualy and print each page seperetly. As this is taking allot of time I want to automate this process.
Can someone help me out with a way to do that or a macro to do this.
Thanks in advanced.

Lighting
Lighting is offline   Reply With Quote
Old Apr 13th, 2002, 06:54 PM   #3
daleyman
Board Regular
 
Join Date: Mar 2002
Location: London, UK
Posts: 167
Default

before writing a complex macro, may i suggest that you use the "Rows to repeat at Top" to give you the repetition, and settle for just having a page footer with the "Page # of #" embedded in it?
__________________

<table style="background-color:#0e54be" cellspacing="1" cellpadding="2"><td style="background-color:#ceffff;font-family:arial;color:#072c63;font-size:8pt;">***DALEY** :P**</td></table>
daleyman is offline   Reply With Quote
Old Apr 13th, 2002, 07:00 PM   #4
Lighting
 
Join Date: Apr 2002
Posts: 11
Default

Hi daleyman,
I can not do that as the invoice is in a pre define format that the company have for some years now. They use to fill this with a type writter.

Lightman
Lighting is offline   Reply With Quote
Old Apr 13th, 2002, 07:06 PM   #5
daleyman
Board Regular
 
Join Date: Mar 2002
Location: London, UK
Posts: 167
Default

ah, beautiful tradition.

If i came across this at work I would do a full overhaul of the worksheet and sell it to the managers as being worth the change.

if that aint an option, the vba will really depend on the exact layout of your required solution. feel free to mail me with the workbook if it isn't too sensitive: david@monnetqos.com and i'll review it tomorrow.

__________________

<table style="background-color:#0e54be" cellspacing="1" cellpadding="2"><td style="background-color:#ceffff;font-family:arial;color:#072c63;font-size:8pt;">***DALEY** :P**</td></table>
daleyman is offline   Reply With Quote
Old Apr 13th, 2002, 07:22 PM   #6
Lighting
 
Join Date: Apr 2002
Posts: 11
Default

daleyman,

Thanks for your offer.

I ahve just send you the file.

Lighting
Lighting is offline   Reply With Quote
Old Apr 13th, 2002, 09:14 PM   #7
daleyman
Board Regular
 
Join Date: Mar 2002
Location: London, UK
Posts: 167
Default

for the benefit of the board, the initial solution looks like this...


Public pagecount As Integer


Sub print_all()
pagecount = 4

'set rows to repeat at top of each page and to fit to single page

ActiveSheet.PageSetup.PrintTitleRows = "$69:$79"
With ActiveSheet.PageSetup
.FitToPagesWide = 1
.FitToPagesTall = 1
End With

'print each page...

print_page 80, 126, 1
print_page 127, 177, 2
print_page 178, 228, 3
print_page 229, 279, 4
print_page 280, 330, 5
print_page 331, 381, 6
print_page 382, 412, 7

End Sub

Sub print_page(startrow, endrow, pagenumber)

'set "page # of #"
Range("S70").Value = pagenumber & " of " & pagecount

'set print area
ActiveSheet.PageSetup.PrintArea = "$M$" & startrow & ":$W$" & endrow

'print page
ActiveWindow.SelectedSheets.PrintOut copies:=1

End Sub




would've liked to have the code work out how many pages and where the breaks should be, but the sheet layout was sporadic, so it would've got messy.

Lightman, if you like send me it again with equal numbers of rows per section and i'll recode it, if you need it to be more flexible.
__________________

<table style="background-color:#0e54be" cellspacing="1" cellpadding="2"><td style="background-color:#ceffff;font-family:arial;color:#072c63;font-size:8pt;">***DALEY** :P**</td></table>
daleyman is offline   Reply With Quote
Old Apr 13th, 2002, 11:41 PM   #8
Jay Petrulis
MrExcel MVP
 
Jay Petrulis's Avatar
 
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
Default

Quote:
On 2002-04-13 17:48, Lighting wrote:
Can someone help me with the following?

I have to print an invoice which can change from 1 to 7 pages. I have set a print range and the rows that are empty I just delete them. By doing this the quantity of pages change. I have some repeated rows that have to print on each page.
Now my problem begins. Somewhere in the repeated rows I have to print page # of #.
I am doing this now by changing the numbers manualy and print each page seperetly. As this is taking allot of time I want to automate this process.
Can someone help me out with a way to do that or a macro to do this.
Thanks in advanced.

Lighting
Hi,

This puts the Page # of ## in range M4 of the active sheet. Adjust to suit.

---begin VBA---
Sub InsertPageNumData()

Dim Pagecount as Integer
Dim PageNumber as Integer

PageCount = ExecuteExcel4Macro("Get.Document(50)")
For PageNumber = 1 To PageCount
Range("M4") = "Page " & PageNumber & " of " & PageCount
ActiveWindow.SelectedSheets.PrintOut From:=PageNumber, To:=PageNumber
Next PageNumber

End Sub
---end VBA---

HTH,
Jay
Jay Petrulis is offline   Reply With Quote
Old Apr 14th, 2002, 07:38 AM   #9
Lighting
 
Join Date: Apr 2002
Posts: 11
Default

Thanks for the solutions.
I'll test them Monday at work when I have the full access to all data and let you know how it turned out.
Lighting
Lighting is offline   Reply With Quote
Old Apr 15th, 2002, 04:02 AM   #10
Lighting
 
Join Date: Apr 2002
Posts: 11
Default

Bumb

Don't see my post after last reply.
Lighting is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 12:36 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes