Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Auto Choosing Pages to Copy
Hi:
I have a large worksheet containing a lengthy report that I need to further automate. I need to send this to Acrobat and if I can get this to work it will save massive amounts of time merging, etc the pdf file. I need to be able to have a macro select another sheet, determine which pages in that sheet have data, then copy the sheet, select the original (master) sheet, find the next empty section, and paste the copied data. All Pages in all worksheets are sized alike and I have been able to get the following code to select the data and print it , but I could sure use some help going forward. Sheets("Estimated Parts").Select Range("o129").Select If ActiveCell < "" Then ActiveWindow.SelectedSheets.PrintOut From:=5, To:=5, Copies:=1 End If Range("O99").Select If ActiveCell < "" Then ActiveWindow.SelectedSheets.PrintOut From:=4, To:=4, Copies:=1 End If Range("o69").Select If ActiveCell < "" Then ActiveWindow.SelectedSheets.PrintOut From:=3, To:=3, Copies:=1 End If Range("o39").Select If ActiveCell < "" Then ActiveWindow.SelectedSheets.PrintOut From:=2, To:=2, Copies:=1 End If Range("o9").Select If ActiveCell < "" Then ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1, Copies:=1 End If Thanks in advance for your help, Sam |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Auto Choosing Pages to Copy
Hi Don:
Thanks for your reply. I'm not sure I was clear enough about what I really need to do with this macro, let me add this. Hopefully you can shed a bit of light on this. as for the ranges, the worksheet has 10 pages, each is 30 rows, with the first data entry cell in each sheet, being the 9th cell, ie : a9, a39, a69, etc... The pages are all formatted with logos, disclosures, etc and I never know if I will have enough data for 1 page, 10 pages, or no pages .If that first cell on each page has data in it, I need to copy that entire page, formatting as well. Then I need to select the actual report worksheet, "INV", find the last cell with data, then select the next cell in column A and paste the entire page, or pages. I then need to run this several more times for another worksheet containing the same types of data..and put those non empty pages after the first set. The Pages from each worksheet may be as many as 10, or as few as 0, depending on whether or not there is any data of that particular type...and all pages in these other worksheets are also the same size. Thanks, Sam -----Original Message----- maybe this idea will help. Selections are often NOT necessary. Sub printif() If Sheets("sheet11").Range("a1") < "" Then Sheets ("sheet11").Printout End Sub -- Don Guillett SalesAid Software "Sam Fowler" wrote in message ... Hi: I have a large worksheet containing a lengthy report that I need to further automate. I need to send this to Acrobat and if I can get this to work it will save massive amounts of time merging, etc the pdf file. I need to be able to have a macro select another sheet, determine which pages in that sheet have data, then copy the sheet, select the original (master) sheet, find the next empty section, and paste the copied data. All Pages in all worksheets are sized alike and I have been able to get the following code to select the data and print it , but I could sure use some help going forward. Sheets("Estimated Parts").Select Range("o129").Select If ActiveCell < "" Then ActiveWindow.SelectedSheets.PrintOut From:=5, To:=5, Copies:=1 End If Range("O99").Select If ActiveCell < "" Then ActiveWindow.SelectedSheets.PrintOut From:=4, To:=4, Copies:=1 End If Range("o69").Select If ActiveCell < "" Then ActiveWindow.SelectedSheets.PrintOut From:=3, To:=3, Copies:=1 End If Range("o39").Select If ActiveCell < "" Then ActiveWindow.SelectedSheets.PrintOut From:=2, To:=2, Copies:=1 End If Range("o9").Select If ActiveCell < "" Then ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1, Copies:=1 End If Thanks in advance for your help, Sam . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Auto-populate, Auto-copy or Auto-fill? | Excel Worksheet Functions | |||
how do i auto number pages in excel | Excel Discussion (Misc queries) | |||
Auto Number Several Pages | Excel Discussion (Misc queries) | |||
Auto Fill Cells, When Choosing From Drop-Down List... | Excel Worksheet Functions | |||
How do I remove the auto border from my printed pages in Excel | Excel Discussion (Misc queries) |