count total number of print page

monchichi1 2008-09-10 11:05:46
hi,please help. how to count the total number of print page display at Sheets("label") range("G8").
for example: total number of print page is 8
page 1 of 8
page 2 of 8
page 3 of 8
"
"
page 8 of 8

please help,thanks.
...全文
83 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
打死不掉牙 2008-09-10
  • 打赏
  • 举报
回复
you should define a variable first.for example: dim i As integer
Then add 1 to i when you print.finally the variable i is the total number.
打死不掉牙 2008-09-10
  • 打赏
  • 举报
回复
where is the Loop Control?Just like For,While and so on.
monchichi1 2008-09-10
  • 打赏
  • 举报
回复
current i'm able to count the total page of print.

but the problem now is,if there have 5 page to print the result come out is 1-5,cannot print out
2-5 pages,3-5 pages.

this is the current code:
Sub PageInfo()
Dim iPages As Integer
Dim iCol As Integer
Dim iCols As Integer
Dim lRows As Long
Dim lRow As Long
Dim iPage As Integer


iPages = Worksheets("label").Range("k3")

With ActiveSheet
If .PageSetup.Order = xlDownThenOver Then
iPage = (iCol - 1) * (lRows + 1) + lRow
Else
iPage = (lRow - 1) * (iCols + 1) + iCol
End If
End With


Worksheets("label").Range("g6") = iPage & " of " & iPages & " pages"

End Sub

please help.thanks.

2,462

社区成员

发帖
与我相关
我的任务
社区描述
VBA(Visual Basic for Applications)是Visual Basic的一种宏语言,是在其桌面应用程序中执行通用的自动化(OLE)任务的编程语言。
社区管理员
  • VBA
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧