VBA to set print area of single page

S

shikamikamoomoo

I have limited knowlege in VBA and would like help modifying the cod
below. I have placed this in the workbook area of the VB
editor....however I need this to really only apply to one page of th
workbook. As is it is interferring with the other pages. Basically o
the sheet "Hourly Update" I need it to print rows 1-(variable) based o
column c (only print as far down as there are entries in column c).
But for the other pages I would like it to print with the individua
print areas already assigned to that page.

Here is the code that I currently have:

Private Sub Workbook_BeforePrint(Cancel As Boolean)

ActiveSheet.PageSetup.PrintArea = Range("A1:Ak" & _
Range("c" & Rows.Count).End(xlUp).Row).Resize.Address
End Sub

I'm sure it is a lot easier than I am trying to make it, but I've trie
everything that I know how.

Thanks in advance,
Jenn
 
T

Tom Ogilvy

Private Sub Workbook_BeforePrint(Cancel As Boolean)
if Activesheet.Name = "Hourly Update" then
ActiveSheet.PageSetup.PrintArea = Range("A1:Ak" & _
Range("c" & Rows.Count).End(xlUp).Row).Resize.Address
End If
End Sub

--
Regards,
Tom Ogilvy


"shikamikamoomoo"
 

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

Similar Threads


Top