Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default optimum method to print rows as columns

looking to convert each spreadsheet row to print as a column per page
--
Concord
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,203
Default optimum method to print rows as columns

If you've got more than one or two rows to deal with, the optimum is probably
the macro below. You'll need to change the names of the two worksheets
involved, and the "EmptySheet" referred to may even have to be added to your
workbook if all the sheets in it are currently being used for something.

To put the code to work: Start by making a copy of your workbook to test
things with. Then open that copy and press [Alt]+[F11] and choose
Insert--Module and then copy and paste the code below into the empty module,
edit to change the names of the two worksheets involved and close the VB
Editor.

Select the sheet with the rows to print as columns and then use Tools --
Macro -- Macros and select the macro in the list and click the [Run] button.

Each row, one by one, will be printed as a single column on separate pages.

Sub SpecialPrint()
'need an empty sheet (named EmptySheet in this code)
'to receive the data to be printed
Dim srcWS As Worksheet
Dim destWS As Worksheet
Dim copyRange As Range
Dim lastRow As Long
Dim lastColumn As Long
Dim LC As Long ' loop counter

'change this to the name of the worksheet with the
'rows of data that need to be transposed and printed
'as a column
Set srcWS = ThisWorkbook.Worksheets("SourceRowsSheet")
'change name of sheet as required
Set destWS = ThisWorkbook.Worksheets("EmptySheet")
'pick a column that has entries in all cells
'or at least an entry in the last row that needs
'to be processed
lastRow = srcWS.Range("A" & Rows.Count).End(xlUp).Row
srcWS.Activate
Application.ScreenUpdating = False
For LC = 1 To lastRow
destWS.Cells.Clear ' clears contents and formats
lastColumn = srcWS.Cells(LC, Columns.Count).End(xlToLeft).Column
Set copyRange = srcWS.Range(Cells(LC, 1), Cells(LC, lastColumn))
copyRange.Copy
destWS.Range("A1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=True
Application.CutCopyMode = False
'destWS.PrintOut copies:=1
Next ' end of LC loop
'housekeeping
Set copyRange = Nothing
Set srcWS = Nothing
Set destWS = Nothing
End Sub


"Concord" wrote:

looking to convert each spreadsheet row to print as a column per page
--
Concord

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
In Excel, how do I get blank rows and columns to print? cvfc the dj Excel Discussion (Misc queries) 9 January 4th 19 01:20 AM
wrap columns to print in rows jenn Excel Discussion (Misc queries) 1 November 26th 09 04:17 PM
excell does not print rows or columns dan Excel Discussion (Misc queries) 1 December 18th 06 03:16 AM
Want to print only rows that have value in certain columns- Excel pwalk Excel Discussion (Misc queries) 2 June 15th 06 06:23 PM
How do I get to print my spreadsheet (8 columns x 100 rows) on an. Bruce Michael Excel Discussion (Misc queries) 2 April 25th 05 05:40 AM


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