首页 > 其他分享 >VBA报表相关

VBA报表相关

时间:2022-11-17 15:17:12浏览次数:48  
标签:Case VBA End 报表 sRange 相关 Select iPageCount

VBA同Sheet分页处理

 1 Private Sub AddPage()
 2     Sheets(BaseSheetNam).Select
 3     Rows("1:47").Select
 4     Selection.Copy
 5     Sheets(LsNowSheetNam).Select
 6     Rows(iPageCount * Meisai_EndRow + 1).Select
 7     ActiveSheet.Paste
 8     
 9     iPageCount = iPageCount + 1
10     ActiveSheet.PageSetup.PrintArea = "$A$1:$I$" & iPageCount * Meisai_EndRow
11     LiNowRow = Meisai_SttRow + ((iPageCount - 1) * Meisai_EndRow)
12 
13 End Sub

VBA设置页脚

1 Application.PrintCommunication = False
2     With ActiveSheet.PageSetup3         .LeftFooter = "&""MS ゴシック,標準""&11 " & " " & oSys.RptFooter
4         .RightFooter = "&""MS ゴシック,標準""&11   " & "&D     &T          " & "&P    "
5     End With
6 Application.PrintCommunication = True

VBA设置线条

 1 'セルの線を設定する
 2 Private Sub SetLine(iLineType As Integer, sRange As String)
 3     Select Case iLineType
 4         '点線(横)
 5         Case 1
 6             With Range(sRange).Borders(xlEdgeTop)
 7                  .LineStyle = xlDot
 8                  .TintAndShade = 0
 9                  .Weight = xlThin
10             End With
11         
12         '罫線(横)
13         Case 2
14             With Range(sRange).Borders(xlEdgeBottom)
15                 .LineStyle = xlContinuous
16                 .ColorIndex = xlAutomatic
17                 .TintAndShade = 0
18                 .Weight = xlMedium
19             End With
20             
21         '罫線(縦)細
22         Case 3
23             With Range(sRange).Borders(xlEdgeRight)
24                 .LineStyle = xlContinuous
25                 .ColorIndex = 0
26                 .TintAndShade = 0
27                 .Weight = xlThin
28             End With
29             
30         '点線(縦)
31         Case 4
32             With Range(sRange).Borders(xlEdgeRight)
33                 .LineStyle = xlDot
34                 .TintAndShade = 0
35                 .Weight = xlThin
36             End With
37     End Select
38 End Sub

 

标签:Case,VBA,End,报表,sRange,相关,Select,iPageCount
From: https://www.cnblogs.com/FocusCtrlC-V/p/16899514.html

相关文章