|
▼ichinose さん:
こんばんは
ichinoseさんが書いて頂いたMk_sample_dataに追加して作りました
下記で私の方は現象が再現されております
列が1ページで収まらない場合に起こる感じです
宜しくお願いします
Sub Mk_sample_data()
Dim rng As Range
With ActiveSheet
With .Range("a1:R1")
.Value = Array("項目1", "項目2", "項目3", "項目4", "項目5", "項目6", "項目7", _
"項目8", "項目9", "項目10", "項目11", "項目12", "項目13", "項目14", "項目15" _
, "項目16", "項目17", "項目18")
For Each rng In .Cells
With rng.EntireColumn
.ColumnWidth = .ColumnWidth + 3 * .Column
End With
Next
End With
With .Range("a2:R2500")
.Formula = "=int(rand()*10000)+1"
.Value = .Value
End With
With .PageSetup
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
End With
End With
Cells.Select
Cells.EntireColumn.AutoFit
Range("A1").Select
End Sub
'===========================================================
Sub test()
Dim hhpgnum As Long
Dim hhbk As Variant
Dim idx As Long
With ActiveSheet
.PageSetup.PrintArea = .UsedRange.Address
End With
hhpgnum = ExecuteExcel4Macro("COLUMNS(GET.DOCUMENT(64))")
For idx = 1 To hhpgnum
hhbk = ExecuteExcel4Macro("INDEX(GET.DOCUMENT(64),1," & idx & ")")
MsgBox hhbk & "==== " & IIf(Rows(hhbk).PageBreak = xlPageBreakAutomatic, "自動", "手動")
Next
End Sub
|
|