|
▼kori さん:
とりあえず、落ち対策はしましたが、やっぱり不細工です。
書いてるうちにあまり意味が見出せなくなったので、これくらいにしてください。
Sub サンプル()
Dim Rn As Long, Cn As Long
Application.ScreenUpdating = False
If TypeName(Selection) <> "Range" Then Exit Sub
With Selection
If .Areas.Count > 1 Then Exit Sub
Rn = .Cells(1).Row
Cn = .Cells(1).Column
If Rn > 1 Then Rows("1:" & Rn - 1).Hidden = True
Rows(Rn + .Rows.Count & ":65536").Hidden = True
If Cn > 1 Then Range(Columns(1), Columns(Cn - 1)).Hidden = True
Range(Columns(Cn + .Columns.Count), Columns(256)).Hidden = True
End With
Application.ScreenUpdating = True
End Sub
Sub 解除()
Application.ScreenUpdating = False
With Cells
.EntireColumn.Hidden = False
.EntireRow.Hidden = False
End With
Application.ScreenUpdating = True
End Sub
Sub 代案()
With ActiveSheet
Application.ScreenUpdating = False
.DisplayPageBreaks = False
With .PageSetup
Application.DisplayAlerts = False
.PrintArea = Selection.Address
Application.DisplayAlerts = True
.CenterHorizontally = True
.CenterVertically = True
.Orientation = xlLandscape
.PaperSize = xlPaperA4
.Zoom = 100
End With
Application.ScreenUpdating = True
.PrintPreview
End With
End Sub
|
|