无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

【實例08-間隔行插入分頁符】Excel表格VBA編程實例 代碼分享

2023-02-25 00:36 作者:凌霄百科_Excel辦公程序  | 我要投稿


Private Sub CommandButton處理_Click()

'判斷工作簿名,工作表名不為空

With ThisWorkbook.Worksheets("操作界面")

? ? ?If Trim(.Cells(2, "C").Value) = "" Or Trim(.Cells(6, "C").Value) = "" Or Trim(.Cells(10, "C").Value) = "" _

? ? ?Or Trim(.Cells(10, "D").Value) = "" Or Trim(.Cells(14, "C").Value) = "" Then

? ? ?MsgBox "參數(shù)不能為空"

? ? ?Exit Sub

? ? ?End If

'On Error GoTo 處理出錯

'定義變量

Dim wbname As String

Dim shname As String

wbname = Trim(.Cells(2, "C").Value)

shname = Trim(.Cells(6, "C").Value)

Dim splitrow As Long

Dim startnum As Long

Dim stopnum As Long

splitrow = Trim(.Cells(14, "C").Value)

startnum = Trim(.Cells(10, "C").Value)

stopnum = Trim(.Cells(10, "D").Value)

End With

'處理表格

With Workbooks(wbname).Worksheets(shname)

Dim i

For i = startnum To stopnum Step splitrow

? ? .HPageBreaks.Add before:=.Cells(i, 1)

Next i

End With

Workbooks(wbname).Save

MsgBox "處理完成"

Workbooks(wbname).Activate

ActiveWindow.WindowState = xlMaximized

Workbooks(wbname).Worksheets(shname).Activate

Workbooks(wbname).Worksheets(shname).Cells(1, 1).Select

Exit Sub

處理出錯:

MsgBox Err.Description

End Sub


【實例08-間隔行插入分頁符】Excel表格VBA編程實例 代碼分享的評論 (共 條)

分享到微博請遵守國家法律
福建省| 枣强县| 高唐县| 安泽县| 清苑县| 睢宁县| 孙吴县| 晋宁县| 临武县| 延寿县| 环江| 周至县| 平江县| 青冈县| 镇坪县| 垦利县| 中卫市| 平潭县| 视频| 恩施市| 永登县| 上虞市| 类乌齐县| 鸡西市| 惠州市| 娱乐| 会昌县| 若尔盖县| 凭祥市| 阿拉尔市| 齐齐哈尔市| 大英县| 长岛县| 昔阳县| 辽宁省| 万载县| 鹤壁市| 和龙市| 辰溪县| 泰兴市| 临西县|