Excel VBA条件插入的分页符

时间:2018-10-15 08:25:28

标签: excel excel-vba conditional

我的表格一直在变化,并且在“ C”列中有文本框。另外,“ C”列的单元格中的某些文本太长,因此我将其与VBA打包在一起。我想进行有条件的分页符,将其读入我的打印区域,并在标题前的每个空行之后插入分页符。我的下面的VBA代码运行正常,除了文本被换行了。因此,问题是:如果我在$(document).ready(function() { $(".send").on("click", function() { var selected = true; var birthday = $("#subscription_day"); var birthmonth = $("#subscription_month"); //console.log(birthday+'=>'+birthmonth); if (!birthday.val()) { // Check if birthday is selected birthday.focus().css({ border: "2px solid rgba(255, 0, 0, 0.6)", background: "rgba(255, 0, 0,.05)", transition: "all 0.15s ease-out;" }); selected = false; } if (!birthmonth.val()) { // Check if birthmonth is selected birthmonth.focus().css({ border: "2px solid rgba(255, 0, 0, 0.6)", background: "rgba(255, 0, 0,.05)", transition: "all 0.15s ease-out;" }); selected = false; } return selected; }); }); 中将java.lang.RuntimeException: A broker is already registered on the path /brokers/ids/0. This probably indicates that you either have configured a brokerid that is already in use, or else you have shutdown this broker and restarted it faster than the zookeeper timeout so it appears to be re-registering. 设置为91,则不换行,那么一切正常。但是,必须将文本换行以适合我的页面。然后,根据包装单元格中文本的长度,不存在91行,而是更少。因此,每次隐藏和包装PgSize = 91Sub FitGroupsToPage()Sub FitMyTextPlease()后,数字91都是动态的。每页上的行数也可以不同(取决于每页上包装多少文本)。关于如何解决此问题的任何想法?

Sub HideMyEmptyRows()

1 个答案:

答案 0 :(得分:0)

如果标准行高为15,那么对于91行,总行高将为1365。当文本换行时,行高变为30。因此,您可以尝试将1365定义为每页总行高而不是插入91作为总行数之前。

您可以使用Range("A1").RowHeight

确定行高