Do using range vs. row iteration?

  • Thread starter Thread starter Ed
  • Start date Start date
E

Ed

I'd like to set the height of all my rows to a certain minimum height. At
the moment, the only thing I can make work is to iterate through every row:
For iRow = numRow To 2 Step -1
If Rows(iRow).RowHeight < 25.5 Then
Rows(iRow).RowHeight = 25.5
End If
Next iRow

Is there a faster way to do this using a range?

Ed
 
this sets all rows in the active worksheet to 25.5

Cells.Select
Selection.rowheight = 25.
 
hi
Range("A1", Range("A1").Offset(10, 255)).Select
Selection.RowHeight = 25.5

in this example i just selected a range 10 rows down from
A1 and 255 collumns(all). you will have to find out how to
select your range. the above rowheight command is pretty
instantanious.
regards
 
Hi Ed,
I'd like to set the height of all my rows to a certain minimum
height. At the moment, the only thing I can make work is to iterate
through every row: For iRow = numRow To 2 Step -1
If Rows(iRow).RowHeight < 25.5 Then
Rows(iRow).RowHeight = 25.5
End If
Next iRow

Is there a faster way to do this using a range?

As others have noted, it will be much faster to set the row height on a
range than through iterating over the rows 1 by 1.

This command will set the row height to 25.5 for the entire used range of
the active Worksheet:

ActiveSheet.UsedRange.RowHeight = 35.5

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]
 
Thanks for the tips. I can do that. But sometimes with Word Wrap on, the
information in the row has already made the row more than 25.5. If I make
it "only" 25.5, I will cut off text. Using the iteration, I can check to
see if the row is less than that, and enlarge it if it is; it is left alone,
though, if it's already tall enough.

Ed
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top