Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Print Area Set for Columns but Not Rows

Help,

I thought this would be a redundant question, but I can't seem to find the
answer in any of the previous posts. I have a spreadsheet with Columns A:R,
but I only want columns A:N to print. I also want Excel to automatically
print only up to the last row with data entered. Looking through all the
previous posts, I thought this would do the trick:

Sub PrepareSheet(sht As Worksheet)
Dim lRow As Long
lRow = sht.Range("A:N").SpecialCells(xlCellTypeLastCell). Row
With sht.PageSetup
.PrintArea = "$A$1:$N" & lRow
.Zoom = False
.FitToPagesWide = 1
End With
End Sub

Unfortunately this is only accomplishing half of my desires - while this
DOES only print the rows with inputs, it's printing all my columns (instead
of just columns A to N). Can anybody help me? What's the code I should be
using?

Thanks in advance for any help you can provide!!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Print Area Set for Columns but Not Rows


This should do what you want!
Code:
--------------------
Sub PrepareSheet()
Dim lRow As Long
lRow = ActiveSheet.Range("N" & Rows.Count).End(xlUp).Row
With ActiveSheet.PageSetup
.PrintArea = "$A$1:$N$" & lRow
.Zoom = False
.FitToPagesWide = 1
End With
End Sub
--------------------


Swingdancer42;216398 Wrote:
Help,

I thought this would be a redundant question, but I can't seem to find
the
answer in any of the previous posts. I have a spreadsheet with Columns
A:R,
but I only want columns A:N to print. I also want Excel to
automatically
print only up to the last row with data entered. Looking through all
the
previous posts, I thought this would do the trick:

Sub PrepareSheet(sht As Worksheet)
Dim lRow As Long
lRow = sht.Range("A:N").SpecialCells(xlCellTypeLastCell). Row
With sht.PageSetup
.PrintArea = "$A$1:$N" & lRow
.Zoom = False
.FitToPagesWide = 1
End With
End Sub

Unfortunately this is only accomplishing half of my desires - while
this
DOES only print the rows with inputs, it's printing all my columns
(instead
of just columns A to N). Can anybody help me? What's the code I should
be
using?

Thanks in advance for any help you can provide!!!



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=59441

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Print Area Set for Columns but Not Rows

Hi Simon,

Thanks for helping! Unfortunately it didn't work, I replaced the code I
posted with the code you provided and it is still producing the same results
- it's still printing all my columns (A:R) but I only want it to print A:N.

Any more ideas? Your help is much appreciated!

"Simon Lloyd" wrote:


This should do what you want!
Code:
--------------------
Sub PrepareSheet()
Dim lRow As Long
lRow = ActiveSheet.Range("N" & Rows.Count).End(xlUp).Row
With ActiveSheet.PageSetup
.PrintArea = "$A$1:$N$" & lRow
.Zoom = False
.FitToPagesWide = 1
End With
End Sub
--------------------


Swingdancer42;216398 Wrote:
Help,

I thought this would be a redundant question, but I can't seem to find
the
answer in any of the previous posts. I have a spreadsheet with Columns
A:R,
but I only want columns A:N to print. I also want Excel to
automatically
print only up to the last row with data entered. Looking through all
the
previous posts, I thought this would do the trick:

Sub PrepareSheet(sht As Worksheet)
Dim lRow As Long
lRow = sht.Range("A:N").SpecialCells(xlCellTypeLastCell). Row
With sht.PageSetup
.PrintArea = "$A$1:$N" & lRow
.Zoom = False
.FitToPagesWide = 1
End With
End Sub

Unfortunately this is only accomplishing half of my desires - while
this
DOES only print the rows with inputs, it's printing all my columns
(instead
of just columns A to N). Can anybody help me? What's the code I should
be
using?

Thanks in advance for any help you can provide!!!



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=59441


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Print Area Set for Columns but Not Rows


Swingdancer, it would be good if you could attach the workbook, you can
join the forum in the link below for free, when making a post before you
click the submit button scroll down and you will see Manage Attachments
this is where you can upload a sample workbook, if you do join then
please make your post in this thread
'http://www.thecodecage.com/forumz/showthread.php?t=59441'
(http://www.thecodecage.com/forumz/sh...ad.php?t=59441) so that
people who have been following or helping can continue to do so.

Swingdancer42;217306 Wrote:
Hi Simon,

Thanks for helping! Unfortunately it didn't work, I replaced the code I
posted with the code you provided and it is still producing the same
results
- it's still printing all my columns (A:R) but I only want it to print
A:N.

Any more ideas? Your help is much appreciated!

"Simon Lloyd" wrote:


This should do what you want!
Code:
--------------------
Sub PrepareSheet()
Dim lRow As Long
lRow = ActiveSheet.Range("N" & Rows.Count).End(xlUp).Row
With ActiveSheet.PageSetup
.PrintArea = "$A$1:$N$" & lRow
.Zoom = False
.FitToPagesWide = 1
End With
End Sub
--------------------


Swingdancer42;216398 Wrote:
Help,

I thought this would be a redundant question, but I can't seem to

find
the
answer in any of the previous posts. I have a spreadsheet with

Columns
A:R,
but I only want columns A:N to print. I also want Excel to
automatically
print only up to the last row with data entered. Looking through

all
the
previous posts, I thought this would do the trick:

Sub PrepareSheet(sht As Worksheet)
Dim lRow As Long
lRow = sht.Range("A:N").SpecialCells(xlCellTypeLastCell). Row
With sht.PageSetup
.PrintArea = "$A$1:$N" & lRow
.Zoom = False
.FitToPagesWide = 1
End With
End Sub

Unfortunately this is only accomplishing half of my desires - while
this
DOES only print the rows with inputs, it's printing all my columns
(instead
of just columns A to N). Can anybody help me? What's the code I

should
be
using?

Thanks in advance for any help you can provide!!!



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' ('The Code Cage' (http://www.thecodecage.com))

------------------------------------------------------------------------
Simon Lloyd's Profile: 'The Code Cage Forums - View Profile: Simon

Lloyd' (http://www.thecodecage.com/forumz/member.php?userid=1)
View this thread: 'Print Area Set for Columns but Not Rows - The Code

Cage Forums' (http://www.thecodecage.com/forumz/sh...ad.php?t=59441)




--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=59441

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Print Area Set for Columns but Not Rows

Attachment posted at the Code Cage link below.

Thanks!

"Simon Lloyd" wrote:


Swingdancer, it would be good if you could attach the workbook, you can
join the forum in the link below for free, when making a post before you
click the submit button scroll down and you will see Manage Attachments
this is where you can upload a sample workbook, if you do join then
please make your post in this thread
'http://www.thecodecage.com/forumz/showthread.php?t=59441'
(http://www.thecodecage.com/forumz/sh...ad.php?t=59441) so that
people who have been following or helping can continue to do so.

Swingdancer42;217306 Wrote:
Hi Simon,

Thanks for helping! Unfortunately it didn't work, I replaced the code I
posted with the code you provided and it is still producing the same
results
- it's still printing all my columns (A:R) but I only want it to print
A:N.

Any more ideas? Your help is much appreciated!

"Simon Lloyd" wrote:


This should do what you want!
Code:
--------------------
Sub PrepareSheet()
Dim lRow As Long
lRow = ActiveSheet.Range("N" & Rows.Count).End(xlUp).Row
With ActiveSheet.PageSetup
.PrintArea = "$A$1:$N$" & lRow
.Zoom = False
.FitToPagesWide = 1
End With
End Sub
--------------------


Swingdancer42;216398 Wrote:
Help,

I thought this would be a redundant question, but I can't seem to

find
the
answer in any of the previous posts. I have a spreadsheet with

Columns
A:R,
but I only want columns A:N to print. I also want Excel to
automatically
print only up to the last row with data entered. Looking through

all
the
previous posts, I thought this would do the trick:

Sub PrepareSheet(sht As Worksheet)
Dim lRow As Long
lRow = sht.Range("A:N").SpecialCells(xlCellTypeLastCell). Row
With sht.PageSetup
.PrintArea = "$A$1:$N" & lRow
.Zoom = False
.FitToPagesWide = 1
End With
End Sub

Unfortunately this is only accomplishing half of my desires - while
this
DOES only print the rows with inputs, it's printing all my columns
(instead
of just columns A to N). Can anybody help me? What's the code I

should
be
using?

Thanks in advance for any help you can provide!!!


--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' ('The Code Cage' (http://www.thecodecage.com))

------------------------------------------------------------------------
Simon Lloyd's Profile: 'The Code Cage Forums - View Profile: Simon

Lloyd' (http://www.thecodecage.com/forumz/member.php?userid=1)
View this thread: 'Print Area Set for Columns but Not Rows - The Code

Cage Forums' (http://www.thecodecage.com/forumz/sh...ad.php?t=59441)




--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=59441




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Print Area Set for Columns but Not Rows


Hi Simon,

Thanks again for your help! Attached is one of my worksheets. I had
to delete all the drop-down box information(s) but that shouldn't affect
the question.
Can you help?

Thanks!
Elizabeth


+-------------------------------------------------------------------+
|Filename: FY10 Spend Plan Template for Review.xls |
|Download: http://www.thecodecage.com/forumz/attachment.php?attachmentid=73|
+-------------------------------------------------------------------+

--
Swingdancer42
------------------------------------------------------------------------
Swingdancer42's Profile: http://www.thecodecage.com/forumz/member.php?userid=121
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=59441

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
set print area for variable number of columns CAB horse Excel Programming 2 September 11th 07 04:54 PM
Set Number of Rows in Print Area [email protected] Excel Programming 2 May 15th 07 11:43 AM
Macro to hide rows with a certain cell empty then set print area and print tahrah Excel Programming 12 January 9th 07 03:47 AM
Macro to delete columns and set print area twaccess[_12_] Excel Programming 2 July 6th 04 01:34 PM
Identify and Delete all Rows and Columns NOT in Print Area Keith Young[_2_] Excel Programming 6 December 4th 03 04:36 PM


All times are GMT +1. The time now is 02:11 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"