我的任务是让文本打印并显示,但它比409点的行显示更长。我正在处理的工作表是源表中可以经常更改的目标工作表,但通常只有15个单元中有1个存在此问题。单元格参数是固定的,因此我无法更改字体或列宽。
在电子表格中,我创建了一个宏,它将插入一行或多行,合并所需的单元格并更改行高以增加单元格,但我可以使用IF ... END IF
来查找大于408的行点触发宏?
我正在使用Excel 2007。
答案 0 :(得分:1)
尝试录制宏并更改行的大小。然后检查宏生成的VBA代码,以查看如何在代码中生成Row的大小。
您会注意到VBA代码不使用像素,因此您必须进行转换才能找到相当于409像素的内容。之后,您可以使用循环查找单元格高度大于某个值的所有行:
Dim lng As Long
lng = 1
Do While Not IsEmpty(Range("A" & lng).Value)
If Rows(lng).RowHeight >= 306.75 Then
'Insert the code to add a new row here. When looking at the '
'code in your macro, you can replace the row number (e.g. the "18:18" in '
'Rows("18:18") with the counter variable, lng, like so: Rows(lng).... '
'If you want the *following* row, use Rows(lng+1) instead.
''
'I'm not sure of the command to insert a new row, but if you do insert a '
'new row, watch your counter. You may need to add an additional '
'lng = lng + 1 into your code to account for the newly added row.'
End If
lng = lng + 1
Loop