![]() |
VBA Code printing problem
Hi there hope someone can help me deal to this.
What im trying to achieve is, Send the print job to the print previe and finally sending the job to the printer if desired and NOT prin blank rows beyond the actual data, keeping in mind all cells ar populated with formula linked to sheet1. this dataset has 2 pages. there are 15 datasets on the sheet. this is the formula that I am using to print page one of two, I hav another macro to print page 2 if I see it is occupied by data. ********** this is the code that works as per last sentence. Sub print1() Application.ScreenUpdating = False Sheets("Psheet").Select Range("A1:U60").Select ActiveWindow.SelectedSheets.PrintPreview Selection.PrintOut Copies:=1, Collate:=True Sheets("sheet1").Select Range("D7").Select Application.ScreenUpdating = True End Sub ************* this is the code that gives me the yes no criteria but drops the rang selection and tries to print the entire sheet which is 30 printabl pages. :-( ************* Sub myprint1test() If MsgBox("Do you want to Print this Document?", vbYesNo, "Repor Preview and Print Check") = vbNo Then Exit Sub Application.ScreenUpdating = False Sheets("Print1test").Select Range("A1:U60").Select ActiveWindow.SelectedSheets.PrintPreview Selection.PrintOut Copies:=1, Collate:=True Sheets("sheet1").Select Range("D7").Select Application.ScreenUpdating = True MsgBox "Your Report is now Printing" End Sub Hope someone can end my misery. I know it must be a simple solution t fix it but I can't figure it out. Im hoping to use this fix in a another spreadsheet which is about 50 rows long. Thanks in advance -- Message posted from http://www.ExcelForum.com |
All times are GMT +1. The time now is 07:17 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com