Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 271
Default Autofit - But At Least a Certain Height

In my spreadsheet, I have my row height set at 40 because that way everything
displays nicely when I print it out on letterhead (landscape). Is there a
way for me to adjust my cell height to make sure I have a height of at least
40, but allow it to adjust automatically for longer entries?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Autofit - But At Least a Certain Height

You could use a macro that does the autofit and then compares the results to
40. If it's smaller, then it'll resize the rowheight.

Option Explicit
Sub testme01()
With Worksheets("Sheet1")
.Rows(1).AutoFit
If .Rows(1).RowHeight < 40 Then
.Rows(1).RowHeight = 40
End If
End With
End Sub


If you're new to macros:

Debra Dalgleish has some notes how to implement macros he
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)

Susan wrote:

In my spreadsheet, I have my row height set at 40 because that way everything
displays nicely when I print it out on letterhead (landscape). Is there a
way for me to adjust my cell height to make sure I have a height of at least
40, but allow it to adjust automatically for longer entries?


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 271
Default Autofit - But At Least a Certain Height

Dave:

When I tried to run that macro, I received the following error:

Run time error "9"
Subscript out of range

Any suggestions? Thank you.

"Susan" wrote:

In my spreadsheet, I have my row height set at 40 because that way everything
displays nicely when I print it out on letterhead (landscape). Is there a
way for me to adjust my cell height to make sure I have a height of at least
40, but allow it to adjust automatically for longer entries?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 271
Default Autofit - But At Least a Certain Height

NEVERMIND DAVE IT WORKED!!!!! Thank you so much for your help.

"Susan" wrote:

In my spreadsheet, I have my row height set at 40 because that way everything
displays nicely when I print it out on letterhead (landscape). Is there a
way for me to adjust my cell height to make sure I have a height of at least
40, but allow it to adjust automatically for longer entries?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Autofit of row height Scott Excel Discussion (Misc queries) 2 September 23rd 08 04:18 PM
Autofit for row height is not working. Why? Leo Excel Discussion (Misc queries) 3 July 28th 08 06:43 PM
Autofit row height Odie Excel Discussion (Misc queries) 7 April 12th 08 07:25 PM
Need a row to autofit height after it's value changes Rob E[_2_] Excel Discussion (Misc queries) 6 June 20th 07 08:00 PM
Autofit Row Height MarkN Excel Discussion (Misc queries) 0 November 21st 05 03:38 AM


All times are GMT +1. The time now is 05:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"