Supress Rows Before Printing - Toolbar Icons become disable

I

igbert

I have used the following Macros from the Discussoion Group in Excel 2007 to
supress printing of Row 1 to 5.

Private Sub Workbook_BeforePrint(Cancel As Boolean)

' Hide Row 1 to Row 5 when printing

If ActiveSheet.Name = "Adjustment" Then
Cancel = True
Application.EnableEvents = False
Application.ScreenUpdating = False
With ActiveSheet
.Rows("1:5").EntireRow.Hidden = True
.PrintOut
.Rows("1:5").EntireRow.Hidden = False
End With
Application.EnableEvents = True
Application.ScreenUpdating = True
End If
End Sub

However, after I clicked "Print Preview", all toolbar icons are disable for
selection. I can only get out from pressing the "Esc' key.

When I take out the above Macro, selection becomes available.

Hope someone can help.

Thanks.

Igbert
 
K

Kassie

You can delete the .Printout line, and replace it with
Application.Dialogs(xlDialogPrint).Show.
That brings up the normal excel print dialog form, which allows you to
select printers, page nrs, and to preview.

Then remove the period in front of Rows in the next line

--
HTH

Kassie

Replace xxx with hotmail
 
I

igbert

Hi Kassie,

Thanks for the solution.

Is there a way to use this macro for printing different worksheets
depressing different rows within the same workbook.

Thanks,

Igbert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top