开发者

Adjusting Row Height Automatically in Excel

开发者 https://www.devze.com 2022-12-12 16:07 出处:网络
In excel (2003), I have a list of items on one page that my estimator can select from, and then on the invoice it prints the items selected....but I don\'t want blank lines for the items not selected.

In excel (2003), I have a list of items on one page that my estimator can select from, and then on the invoice it prints the items selected....but I don't want blank lines for the items not selected. How do I get either the empty row height to be 0, or have the rows without data collapse开发者_如何学运维. Is this possible.


You can set the RowHeight property programmatically in Excel.

For example you might loop over a range of rows and alter the RowHeight:

Dim row As Range
For Each row In ActiveWorkbook.Worksheets("Sheet1").Range("10:20").Rows
    row.RowHeight = 0
Next

Or perform some conditional evaluation:

Dim row As Range
For Each row In ActiveWorkbook.Worksheets("Sheet1").Range("10:20").Rows
    If row.Cells(1, 2).Value = 10 Then row.RowHeight = 0
Next

Or delete the row:

row.Delete
0

精彩评论

暂无评论...
验证码 换一张
取 消