Board logo

標題: [分享] 終於找到自動分頁的答案 [打印本頁]

作者: linshin1999    時間: 2011-1-3 12:48     標題: 終於找到自動分頁的答案

謝謝Hsieh,GBKEE兩位版主的指導,自動分頁可以這寫:
Sub 自動分頁
    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
    Dim jump_page
   
    ActiveWindow.View = xlPageBreakPreview
    first_row = 50
    jump_page = 50
    For i = first_row To rows_count Step jump_page
        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




歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)