Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA to set print area of single page


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

--
shikamikamoomo
-----------------------------------------------------------------------
shikamikamoomoo's Profile: http://www.excelforum.com/member.php...fo&userid=2101
View this thread: http://www.excelforum.com/showthread.php?threadid=51600

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VBA to set print area of single page

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"
<shikamikamoomoo.23pega_1140734102.676@excelforu m-nospam.com wrote in
message news:shikamikamoomoo.23pega_1140734102.676@excelfo rum-nospam.com...

I have limited knowlege in VBA and would like help modifying the code
below. I have placed this in the workbook area of the VBA
editor....however I need this to really only apply to one page of the
workbook. As is it is interferring with the other pages. Basically on
the sheet "Hourly Update" I need it to print rows 1-(variable) based on
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 individual
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 tried
everything that I know how.

Thanks in advance,
Jenny


--
shikamikamoomoo
------------------------------------------------------------------------
shikamikamoomoo's Profile:

http://www.excelforum.com/member.php...o&userid=21018
View this thread: http://www.excelforum.com/showthread...hreadid=516008



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA to set print area of single page


I knew it was that simple!! So close, yet so far. :D Thanks for the
help.


--
shikamikamoomoo
------------------------------------------------------------------------
shikamikamoomoo's Profile: http://www.excelforum.com/member.php...o&userid=21018
View this thread: http://www.excelforum.com/showthread...hreadid=516008

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
split print area in excel - One Page Print Cyhill Excel Worksheet Functions 3 November 12th 08 08:39 PM
Setting the print area in page set up to print 1 page wide by 2 pages tall EA[_2_] Excel Discussion (Misc queries) 2 July 12th 07 08:39 PM
Print Area. 1st page Landscape 2nd page Portrait?? Corey Excel Worksheet Functions 1 June 23rd 06 08:18 AM
Active cell counting in particular print page (one sheet having different print area) ananthmca2004 Excel Worksheet Functions 1 November 24th 05 11:29 AM
How do you turn off a print area for a page? (no print area) Grunen Excel Discussion (Misc queries) 4 October 8th 05 07:46 PM


All times are GMT +1. The time now is 02:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"