ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automatic row heigth (https://www.excelbanter.com/excel-programming/430808-automatic-row-heigth.html)

Jack Wood[_14_]

Automatic row heigth
 


I have a macro that if entries exceed merged width of columns F thru K,
row will automatically heigthen & wrap text. Problem is that when a
number or letter is entered in column L, columns F thru K convert back
to original heigth without any wrap & row heigthen. Here is my Macro:

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

Set r = Range("f12:k321", "v12:x321")
If Not Intersect(Target, r) Is Nothing 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 Sub


--
Jack Wood
------------------------------------------------------------------------
Jack Wood's Profile: http://www.thecodecage.com/forumz/member.php?userid=346
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=113449


Jack Wood[_15_]

Automatic row heigth
 

I'm still looking for some help on this one. No replys yet. Does
anyone have a fix. Thanks.


--
Jack Wood
------------------------------------------------------------------------
Jack Wood's Profile: http://www.thecodecage.com/forumz/member.php?userid=346
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=113449



All times are GMT +1. The time now is 12:27 PM.

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