我想装页,这样,如果水平页制动器距离最后一行少于8行,则应删除水平页制动器。
m是A列的最后一行:
m = Cells(Rows.Count, "A").End(xlUp).Row + 1
该宏运行了好几周,但在这种情况下(见图),它失败了(运行时错误' 9')。
With ActiveSheet.HPageBreaks
If .Count > 0 Then
'in this instance: .count = 3, m = 83
On Error GoTo fine
If m - .Item(.Count).Location.Row < 8 Then ActiveSheet.HPageBreaks(.Count).DragOff Direction:=xlDown, RegionIndex:=1
End If
End With
我不明白:如果数为3,为什么不存在行号?