Print wrapped columns in Excel 2010

Hi Experts,

How can I get "Excel 2010" to print wrapped columns?

I have two narrow columns within a worksheet.
I would like to wrap(snake)  the columns so that a printed page is filled before going to print the next sheet.
So rows 1 through 60 are in the first two columns page 1,  the next 60 rows are in the 3rd & 4th columns (again page 1), etc.

Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

dlmilleConnect With a Mentor Commented:
The following code assumes a long list of two columns.  It creates an "output sheet" dynamically after prompting you for maximum rows per page of print, and whether you have headers or not.

The App then generates a set of columns, 60 rows by 2 columns, then shifts to the right and regenerates again and again until the end of the data.

Hope this helps.  The 60 rows and 2 columns are defaults, and I've added code to prompt you for those, in case your needs change.

Sub GenerateOutputToPrint()
Dim outSheet As Worksheet
Dim inSheet As Worksheet
Dim outCursor As Range
Dim lRow As Long, lastRow As Long
Dim maxRows As Long, repeatAtTop As Boolean
Dim numColumns As Long

Application.ScreenUpdating = False

    maxRows = InputBox("Enter Max Rows Per Page of Output", "E.g., 60", 60)
    numColumns = InputBox("Enter # Columns in your dataset for printing", "E.g., 2", 2)
    repeatAtTop = MsgBox("Do your columns have headers?", vbYesNo)
    'assumes two columns of data, per original question asked (dlmille E-E on 3/6/2011)
        lastRow = Cells.Find(What:="*", After:=[A1], _
                SearchOrder:=xlByRows, _

        Set inSheet = ActiveSheet
        Set outSheet = Worksheets.Add ' this is where the output will go
        Set outCursor = outSheet.Range("A1")
        For lRow = 1 To lastRow
            outCursor.Resize(1, numColumns).Value = Range(inSheet.Cells(lRow, 1), inSheet.Cells(lRow, numColumns)).Value 'copy the first two columns to output page

            If (lRow - 1) Mod maxRows = 0 And lRow > 1 Then 'every 60 rows, generate new set of columns - so shift outCursor to the right, and back up to the top!
                Set outCursor = outCursor.Offset(0, numColumns).End(xlUp)
                If repeatAtTop Then 'get headers and repeat them
                    outCursor.Resize(1, numColumns).Value = Range(inSheet.Cells(1, 1), inSheet.Cells(1, numColumns)).Value 'copy the first two column headers to new columns
                    Set outCursor = outCursor.Offset(1, 0) 'ready for next row of input
                End If
                Set outCursor = outCursor.Offset(1, 0) 'ready for next row of input
            End If
        Next lRow
Application.ScreenUpdating = True
End Sub

Open in new window

You can format the cells:
Select your cells -> right click -> format cells -> from the Alignment tab check the Wrap text then OK.
Another way is from Home -> Alignment -> Wrap Text.
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

And to adjust the columns visibility you may adjust the column's width and the row's height until you get your desired form to print.
I did a solution on somthing like this (there were two solutions, and mine wasn't picked.  feel free to use the first, but I created a macro that broke the three columns up into page sizes and formatted a page from those columns that could be printed).

Let me know if this helps and if you want to further persue, I"m happy to help!



If you want to keep it all in Excel, the attached "wraps" to 60 rows, and operates on the first 3 columns.  See attached:

The "create word" document tip in the link I sent in the post (above) is a good one, but it is a bit "manual", though a macro COULD be written to handle.

See the second attachment, rewritten to handle the first three Columns in Excel and outputs to the printed page.

If you'd like either modified to suit, or you can take it from here, please let me know!


AndyPandyAuthor Commented:
Thanks dmille, your BA worked well!
I am surprised there is not a native function within excel to do this.
All Courses

From novice to tech pro — start learning today.