merged cell wrap text autofit issue

I

icestationzbra

hello,

i am facing problem while trying to row autofit contents in a merged
cell.

the contents in the merged cell wrap to about 3 lines.

when i click on row autofit, it shows me only the first line. the next
two lines are hidden.

aside from merging cells, i tried to select adjacent cells and chose
centre across selection. i have wrap text here too, but the row autofit
keeps all the lines visible. however, my intention is to keep the
contents left justified, not centred.

can it be helped?

thanks,

mac.
 
I

icestationzbra

hi,

thanks for the link to the site.

using that info and inspiration, i created a macro of my own. this
scrolls thru rows and works for my needs. funny thing is, it only works
well in xl2k2 and not in xl2k.

mac.

Sub autofitrow()

Dim rngCell As Range
Dim intRowH As Integer
Dim n As Integer

With Sheet1

For Each rngCell In .Range("b15:b75")

n = rngCell.Row

Range("b" & n & ":c" & n).Select

Selection.Locked = False
Selection.FormulaHidden = False
Selection.Font.Name = "Verdana"
Selection.Font.Size = "9"

Selection.Merge

rngCell.MergeArea.Merge

'If rngCell.MergeCells Then

With rngCell.MergeArea

..UnMerge
..EntireRow.AutoFit

..HorizontalAlignment = xlCenterAcrossSelection
..VerticalAlignment = xlTop
..WrapText = True
..ShrinkToFit = False
..ReadingOrder = xlContext
..MergeCells = False

intRowH = .RowHeight

..Merge
..RowHeight = intRowH
..HorizontalAlignment = xlLeft


End With

Selection.Locked = True
Selection.FormulaHidden = True
Selection.Font.Name = "Verdana"
Selection.Font.Size = "8"

'Else

' do nothing

'End If

Next rngCell

End With

End Sub
 
S

soopial

I've seen the macro by Jim Rech.
But, is there a way to do this if it is MORE than 1 ROW?
I have a section that is merged from C4:G7

Is there any way to wrap the text AND autofit the height using a rang
such as this?

Looking forward to someone's reply with thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top