将表格下推到工作表上时如何保持行高不变 [英] How to keep the Row Height constant when a table is pushed down on the sheet

查看:49
本文介绍了将表格下推到工作表上时如何保持行高不变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张有2张桌子的工作表.每个表都有一个标题,我希望高度为30,而所有表行均为标准15.当我在最上面的表中添加一行时,最下面的表被下推.底部表格上的标题高度用于拾取新电子表格行的高度.有没有一种方法可以使底表的标题高度保持为30?这是我的代码,用于向顶表添加行.

I have a sheet with 2 tables. Each table has a header that I want to be a height of 30 while all table rows are the standard 15. When I add a row to the top table, the bottom table gets pushed down. The header Height on the bottom table picks up the height of the new spreadsheet row. Is there a way to make the bottom table keep its header height at 30? Here is my code to add rows to the top table.

            Set tblAssemblies = Worksheets("Summary").ListObjects("Table1")
            Count = 1
            Do
                tblAssemblies.ListRows.Add AlwaysInsert:=True
                Count = Count + 1
            Loop While Count <= Target.Value - tblAssembliesRows

这将底部表格向下推,但没有按表头高度设置工作表行的格式.有任何想法吗?

This pushed the bottom table down, but not the formatting of the sheet row for the header height. Any Ideas?

丰富

推荐答案

HeaderRowRange.RowHeight

我已经注意到,并且您没有提到,"30高度行移动"到第一张桌子中.这也应该纠正.

HeaderRowRange.RowHeight

I've noticed, and you didn't mention, that the '30-height-row moves' into the first table. This should be corrected, too.

Option Explicit

Sub HeaderRowRangeRowHeight()

  With Worksheets("Summary")
    .ListObjects(2).HeaderRowRange.RowHeight = 30
    .ListObjects(1).DataBodyRange.RowHeight = 15
    .ListObjects(1).TotalsRowRange.RowHeight = 15
  End With

End Sub

这篇关于将表格下推到工作表上时如何保持行高不变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆