高分求教!VBA在EXCELL的应用!

beifang0081 2003-08-18 08:00:28
想要知道每个单元格在每页的位置(是否是到了换页的行)
我使用了Range 的PageBreak或LocationInTable的属性值,
但赋值时出现错误“不能取得Range 的LocationInTable属性”,“不能取得Range 的PageBreak属性”
...全文
22 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
beifang0081 2003-09-05
  • 打赏
  • 举报
回复
up
beifang0081 2003-09-02
  • 打赏
  • 举报
回复
我在做报表,相同项要合并,但换页不能合并,在最后一页若数据未到最后一行,空行也要画格。
beifang0081 2003-08-31
  • 打赏
  • 举报
回复
如何得知每也的行数?
每个工作表的最大页号?
jintianatxd 2003-08-31
  • 打赏
  • 举报
回复
up
xuetianliang 2003-08-31
  • 打赏
  • 举报
回复
这个问题他们都回答了。我在答也没有什么意思了/我不太明白。你为什么要知道他是否到了换页行那。???
gzqg 2003-08-28
  • 打赏
  • 举报
回复
Sheets("SheetName").HPageBreaks.Count
EXCEL在打印满一页时,COUNT值会增加.

既在添加数据时观察Count的值,如果Count 值增加则说明换页,记下当前位置即可.
hxy2003 2003-08-26
  • 打赏
  • 举报
回复
UP
beifang0081 2003-08-26
  • 打赏
  • 举报
回复
我使用下面代码后,报错“不能取得Range 的 LocationInTable”
Private Sub Worksheet_Change(ByVal Target As Range)
Select Case ActiveCell.Column

Case 1
Select Case ActiveCell.LocationInTable
Case Is = xlRowHeader
MsgBox "Active cell is part of a row header"
Case Is = xlColumnHeader
MsgBox "Active cell is part of a column header"
Case Is = xlPageHeader
MsgBox "Active cell is part of a page header"
Case Is = xlDataHeader
MsgBox "Active cell is part of a data header"
Case Is = xlRowItem
MsgBox "Active cell is part of a row item"
Case Is = xlColumnItem
MsgBox "Active cell is part of a column item"
Case Is = xlPageItem
MsgBox "Active cell is part of a page item"
Case Is = xlDataItem
MsgBox "Active cell is part of a data item"
Case Is = xlTableBody
MsgBox "Active cell is part of the table body"
End Select
End Select
End Sub

高手指点!!
ziken 2003-08-21
  • 打赏
  • 举报
回复
应该使用Location属性而不是LocationInTable,

LocationInTable 属性用于描述数据透视表报表中活动单元格所在的位置。

Worksheets("Sheet1").Activate
Select Case ActiveCell.LocationInTable
Case Is = xlRowHeader
MsgBox "Active cell is part of a row header"
Case Is = xlColumnHeader
MsgBox "Active cell is part of a column header"
Case Is = xlPageHeader
MsgBox "Active cell is part of a page header"
Case Is = xlDataHeader
MsgBox "Active cell is part of a data header"
Case Is = xlRowItem
MsgBox "Active cell is part of a row item"
Case Is = xlColumnItem
MsgBox "Active cell is part of a column item"
Case Is = xlPageItem
MsgBox "Active cell is part of a page item"
Case Is = xlDataItem
MsgBox "Active cell is part of a data item"
Case Is = xlTableBody
MsgBox "Active cell is part of the table body"
End Select
paocai2003 2003-08-19
  • 打赏
  • 举报
回复
是啊. 能说的详细点更好. 用cell(变量,1) 是否等于空来判断.
DarkChampion 2003-08-19
  • 打赏
  • 举报
回复
能把这段代码贴出来让大家看看吗?

2,462

社区成员

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

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