ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Automate row height to fit text (https://www.excelbanter.com/excel-discussion-misc-queries/102308-automate-row-height-fit-text.html)

JLSmith

Automate row height to fit text
 
Is there a way for a row to expand to fit the text entered without manually
increasing the row height?
--
Jerri

Gord Dibben

Automate row height to fit text
 
Select row(s) and FormatRowAutofit


Gord Dibben MS Excel MVP

On Mon, 31 Jul 2006 11:47:01 -0700, JLSmith
wrote:

Is there a way for a row to expand to fit the text entered without manually
increasing the row height?



JLSmith

Automate row height to fit text
 
Is there a way to Autofit merged cells in one row?
--
Jerri


"Gord Dibben" wrote:

Select row(s) and FormatRowAutofit


Gord Dibben MS Excel MVP

On Mon, 31 Jul 2006 11:47:01 -0700, JLSmith
wrote:

Is there a way for a row to expand to fit the text entered without manually
increasing the row height?




Gord Dibben

Automate row height to fit text
 
Merged cells will not Autofit.

You need VBA code to do that.

Here is code from Greg Wilson.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim NewRwHt As Single
Dim cWdth As Single, MrgeWdth As Single
Dim c As Range, cc As Range
Dim ma As Range

With Target
If .MergeCells And .WrapText Then
Set c = Target.Cells(1, 1)
cWdth = c.ColumnWidth
Set ma = c.MergeArea
For Each cc In ma.Cells
MrgeWdth = MrgeWdth + cc.ColumnWidth
Next
Application.ScreenUpdating = False
ma.MergeCells = False
c.ColumnWidth = MrgeWdth
c.EntireRow.AutoFit
NewRwHt = c.RowHeight
c.ColumnWidth = cWdth
ma.MergeCells = True
ma.RowHeight = NewRwHt
cWdth = 0: MrgeWdth = 0
Application.ScreenUpdating = True
End If
End With
End Sub


Gord Dibben MS Excel MVP


On Tue, 1 Aug 2006 06:29:01 -0700, JLSmith
wrote:

Is there a way to Autofit merged cells in one row?




All times are GMT +1. The time now is 06:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com