使用'Table.ListRows.Add'在表格边界之外插入整行(Insert entire row beyond Table bounds using 'Table.

系统教程 行业动态 更新时间:2024-06-14 16:57:17
使用'Table.ListRows.Add'在表格边界之外插入整行(Insert entire row beyond Table bounds using 'Table.ListRows.Add')

我必须在Excel表中插入一个空行。 要在我正在使用的表中插入行:

bugetTable.ListRows.Add AlwaysInsert:=True

到目前为止一切顺利,但理想的结果是整行需要移动而不仅仅是表中的行。 我的意思是,表范围是四列宽,所以我需要插入的行占用超过四列。 我使用表而不是范围行方法来满足技术要求。

我使用的是Office 2010,Windows 8.1。

I have to insert a blank row in an Excel Table. To insert the row in the Table I am using:

bugetTable.ListRows.Add AlwaysInsert:=True

So far so good, but the desired result is that the entire row needs to be shifted not just the row in the Table. What I mean is, the Table range is four columns wide, so I need that the inserted row take more than the four columns. I am using the Table instead of the range row approach for technical requirements.

I am using Office 2010, Windows 8.1.

最满意答案

Dim b As Integer Dim b As Integer

另外3个步骤:

获取表格的最后一行:

a = ListObjects(YourTable).Range.Rows.Count

获取表格开始的行:

b = ListObjects(YourTable).Range.Cells(1).Row

在表格末尾插入行:

Rows(a + b - 1).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove Dim b As Integer Dim b As Integer

And, additional 3 steps:

Get the last row of the table:

a = ListObjects(YourTable).Range.Rows.Count

Get the row your table begins:

b = ListObjects(YourTable).Range.Cells(1).Row

Insert row by the end of the table:

Rows(a + b - 1).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove

更多推荐

本文发布于:2023-04-12 20:03:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/28dd5357439b0425c66eab70f5a587f5.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:边界   表格   ListRows   Add   Table

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!