View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jack Wood[_14_] Jack Wood[_14_] is offline
external usenet poster
 
Posts: 1
Default 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