Hsieh版主謝謝,我找到了解決方案了:
Sub 自動分頁
Dim rows_count As Long
Dim page_count As Long
Dim i As Long
Dim row_index As Long
Dim str_row_index As String
Dim first_row As Long
ActiveWindow.View = xlPageBreakPreview
rows_count = Range("A1").CurrentRegion.Rows.Count
first_row = 50
For i = first_row To rows_count Step 50
page_count = page_count + 1
str_row_index = "A" + Trim(Str(i + 1))
Set ActiveSheet.HPageBreaks(page_count).Location = Range(str_row_index)
Next i
ActiveWindow.View = xlNormalView
End Sub