I have created spreadsheets, to list students and their data, that have to be
updated weekly. The lists have to be printed as well. To keep the width
within one page, the font has to stay at 8 pts. For ease of reading, each
record alternates color from its quot;neighborsquot;. I have created macros to
reshuffle the colors after I resort names when new ones are added in, since
the color of the records follows the name to its new row. I have a value of
40 for the height of the rows that is mostly adequate. The problem comes from
a wrapping memo field within each record that may increase the height of the
row to above 40 pts. When I re-sort the list of names, the macros take care
of the colors, but the height of the rows stay put; that means that some
records that could use more space in the memo field get cropped off, while
some that do not need the space may now be located in a row that is too high.
The autofit function works for this problem, except that it quot;squishesquot; the
data, so that it becomes less easy to read. What I would like to do is to be
able to use the autofit function, but also to put a minimum of 40 pts height
per row. Is that possible?
After doing the autofit run this. This will add 40 to each row within
the loop. If you only want to extend those over a cerain size put in an
quot;if quot; to test the row height first.
Dim i As Integer
Dim rng As Range
Set rng = Range(quot;1:1quot;)
For i = 1 To 50
rng.Offset(i).RowHeight = rng.Offset(i).RowHeight 40
Nextbest wishes
Tony--
tony h
------------------------------------------------------------------------
tony h's Profile: www.excelforum.com/member.php...oamp;userid=21074
View this thread: www.excelforum.com/showthread...hreadid=515512I think that you'll have to loop through the rows and look at the rowheights:
Option Explicit
Sub testme()
Dim myRow As Range
With Worksheets(quot;sheet1quot;)
For Each myRow In .Range(quot;a1:A99quot;).EntireRow.Rows
myRow.AutoFit
If myRow.RowHeight lt; 40 Then
myRow.RowHeight = 40
End If
Next myRow
End With
End Sub
NadineWoj wrote:
gt;
gt; I have created spreadsheets, to list students and their data, that have to be
gt; updated weekly. The lists have to be printed as well. To keep the width
gt; within one page, the font has to stay at 8 pts. For ease of reading, each
gt; record alternates color from its quot;neighborsquot;. I have created macros to
gt; reshuffle the colors after I resort names when new ones are added in, since
gt; the color of the records follows the name to its new row. I have a value of
gt; 40 for the height of the rows that is mostly adequate. The problem comes from
gt; a wrapping memo field within each record that may increase the height of the
gt; row to above 40 pts. When I re-sort the list of names, the macros take care
gt; of the colors, but the height of the rows stay put; that means that some
gt; records that could use more space in the memo field get cropped off, while
gt; some that do not need the space may now be located in a row that is too high.
gt; The autofit function works for this problem, except that it quot;squishesquot; the
gt; data, so that it becomes less easy to read. What I would like to do is to be
gt; able to use the autofit function, but also to put a minimum of 40 pts height
gt; per row. Is that possible?
--
Dave Peterson
- Dec 25 Tue 2007 20:41
How do I modify the autofit function in Excel?
close
全站熱搜
留言列表
發表留言