printing in excel

E

Esber

Please help. How do I print in excel. I have data of 5000 rows and each
row has 3 columns. Each A4 page can take around 80 rows of data. In
order to save on paper, I was wondering if I could divide the page to
accommodate 6 rows by printing rows 1-80 on left side of an a4 page and
then rows 81-160 on the right side of the page. And then rows 161 to 241
on the left and rows 321 on the right side of page 2. And so on until
the total 5000 rows are printed. I know I can do this page by page one
at a time using the printscreen option but I was hoping I could set it
up so the printing could be done for the whole 5000 rows. The columns
are narrow (roughly 5 characters only) so no problem fitting 6 columns
in a page. But how do I do this so the printing could be done
continuously for the whole worksheet. thank you so much
 
D

Dave Peterson

Another option maybe to copy the table into word and use its built-in
capabilities to do Columns (Format|columns).

If it's a one time shot, it may be easier. If you're data is just a typing
exercise, maybe you could even leave it in word.
 
G

Gord Dibben

Esber

Sub ReFormat()
Dim iSource As Long
Dim iTarget As Long
iSource = 1
iTarget = 1
Do
Cells(iSource, "A").Resize(80, 3).Cut Destination:=Cells(iTarget, "A")
Cells(iSource + 80, "A").Resize(80, 3).Cut Destination:=Cells(iTarget,
"D")
iSource = iSource + 160
iTarget = iTarget + 81
Loop Until IsEmpty(Cells(iSource, "A").Value)
End Sub

Open the Visual Basic Editor using ALT + F11. View>Project Explorer. Select
your project/workbook and Insert>Module. Paste the code in there then ALT + Q
to return to Excel.

Tools>Macro>Macros. Select the macro "ReFormat" and "Run".

Best to do this on a copy of your workbook to see if final results are what
you want.

Will give you 6 columns per your description, with a blank line between each
grouping.

Watch for line-wrap. Each "Cells(iSource" line is single line.

Gord Dibben Excel MVP
 

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

Top