vba 格式化页面以在 2 列中打印
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13058703/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Format pages to print in 2 columns
提问by Jeff
Does anyone know how to move pages in excel to basically split a spreadsheet in half?
有谁知道如何在 excel 中移动页面以基本上将电子表格一分为二?
Example, I have 390,000 lines in a spreadsheet.
If you were to print the spreadsheet in portrait format with a 12 size font, that would come out to about 44 lines per page at close to 8800 pages.
例如,我在电子表格中有 390,000 行。
如果您要使用 12 号字体以纵向格式打印电子表格,那么每页大约有 44 行,接近 8800 页。
I want to cut that in half.
我想把它切成两半。
I have 3 columns. All I want to do is bring the even pages to the odd pages, where there is plenty of room. Can anyone advise me as to what I can do?
我有 3 列。我想要做的就是将偶数页带到奇数页,那里有足够的空间。谁能告诉我我能做什么?
回答by ExactaBox
When you go to print, set your printer settings to "2 UP" or "2 Pages per sheet". Or try double-siding printing. Or both. I'm kidding here, but is printing 4400 pages really more desirable than printing 8800? Hard to imagine anyone attempting to sort through either pile.
打印时,将打印机设置设置为“2 UP”或“每张纸 2 页”。或尝试双面打印。或两者。我在开玩笑,但是打印 4400 页真的比打印 8800 页更可取吗?很难想象有人试图对任一堆进行分类。
回答by nutsch
Try this macro (after saving your file preferably).
试试这个宏(最好在保存文件后)。
Sub adsagrse()
Dim lRows As Long
'turn off updates to speed up code execution
With application
.ScreenUpdating = False
.EnableEvents = False
.Calculation = xlCalculationManual
.DisplayAlerts = False
End With
lRows = 45
Do While Len(Cells(lRows, 1)) > 0
Cells(lRows, 1).Resize(44, 3).Copy Cells(lRows, 1).Offset(-44, 4)
Cells(lRows, 1).Resize(44, 3).ClearContents
lRows = lRows + 88
llop
ActiveSheet.UsedRange.AutoFilter
ActiveSheet.UsedRange.AutoFilter 1, ""
ActiveSheet.UsedRange.Offset(1).SpecialCells(xlCellTypeVisible).EntireRow.Delete
ActiveSheet.UsedRange.AutoFilter
With application
.ScreenUpdating = True
.EnableEvents = True
.Calculation = xlCalculationAutomatic
.DisplayAlerts = True
End With
End Sub
回答by Hrs
Note : that depend on the printer capabilities
let say you will print on A4 size paper with potrait in this example
1. create custom paper size with half-width of A4 size (height 297mm x width 105mm) in your printer settings
2. go to excel and print as usual but select the new custome paper size that just created
注意:这取决于打印机功能,
假设您将在此示例中使用 potrait 在 A4 尺寸纸张上打印
1. 在打印机设置中创建具有 A4 尺寸半宽(高 297 毫米 x 宽 105 毫米)的自定义纸张尺寸
2. 转到excel 并照常打印,但选择刚刚创建的新客户纸张尺寸
while in print - page setup
3. set your page size same as 'A4 half-width'
4. set your print to 'print 2 pages on 1 page'
5. set your print paper output as normal A4
hope it work on your printer
在打印时 - 页面设置
3. 将页面大小设置为“A4 半宽”
4. 将打印设置为“在 1 页上打印 2 页”
5. 将打印纸输出设置为正常 A4
希望它在您的打印机上工作