#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 343
Default AutoFit

Is there any way to use the code below and still maintain a minimum row
height of 27?

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Target.EntireRow.AutoFit

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 221
Default AutoFit

Target.Rows.AutoFit


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default AutoFit

there may be a way, but i don't know it:

Sub test()
Dim r As Long
With ActiveCell.EntireRow
r = Application.Max(.AutoFit, 27)
..RowHeight = r
End With
End Sub

--


Gary


"Patrick C. Simonds" wrote in message
...
Is there any way to use the code below and still maintain a minimum row height
of 27?

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Target.EntireRow.AutoFit

End Sub



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 221
Default AutoFit

Oops!

Try this

Target.Rows.RowHeight = 27

HTH


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 343
Default AutoFit

I actually came up with a work around.

I needed my rows to have a minimum height of 23, but when I set the row
heights to that the autofix would not increase the row height to account for
those rows where text wrapping took place. So I created a hidden column and
put a number in each row and selected a font size which would produce a row
height that I needed. It worked great.


"NoodNutt" wrote in message
...
Oops!

Try this

Target.Rows.RowHeight = 27

HTH




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default AutoFit

This should do it:

Private Sub Worksheet_Change(ByVal Target As Range)

Target.EntireRow.AutoFit
If Target.RowHeight < 27 Then Target.RowHeight = 27

End Sub

Regards,
Per

"Patrick C. Simonds" skrev i meddelelsen
...
I actually came up with a work around.

I needed my rows to have a minimum height of 23, but when I set the row
heights to that the autofix would not increase the row height to account
for those rows where text wrapping took place. So I created a hidden
column and put a number in each row and selected a font size which would
produce a row height that I needed. It worked great.


"NoodNutt" wrote in message
...
Oops!

Try this

Target.Rows.RowHeight = 27

HTH



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 Maxine Excel Discussion (Misc queries) 2 April 22nd 10 12:50 PM
Autofit (Columns.EntireColumn.AutoFit) does not work Michiel via OfficeKB.com Excel Discussion (Misc queries) 3 February 10th 09 05:29 PM
How to Use AutoFit() Weide Zhang Excel Programming 2 March 17th 07 05:14 AM
Autofit Jentan Excel Programming 1 November 2nd 06 08:12 AM
autofit does not autofit rreneerob Excel Discussion (Misc queries) 1 October 17th 05 05:55 PM


All times are GMT +1. The time now is 09:07 AM.

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

About Us

"It's about Microsoft Excel"