Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to set AutoFit property in Excel for merged cells

Using JScript.
I have merged some amount of cells and type some text in.
How can I to set autofit for text in merged cells
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default How to set AutoFit property in Excel for merged cells

So far as I'm aware, Autofit does not work for merged cells (Excel 2002)


--
Roger
Shaftesbury (UK)


"Roman Malakhovetskyy" wrote in
message ...
Using JScript.
I have merged some amount of cells and type some text in.
How can I to set autofit for text in merged cells



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to set AutoFit property in Excel for merged cells

Merged cells done support Autofit.

You might pursue some code like this posted by Jim Rech:

Jim Rech

Sub AutoFitMergedCellRowHeight()
Dim CurrentRowHeight As Single, MergedCellRgWidth As Single
Dim CurrCell As Range
Dim ActiveCellWidth As Single, PossNewRowHeight As Single
If ActiveCell.MergeCells Then
With ActiveCell.MergeArea
If .Rows.Count = 1 And .WrapText = True Then
Application.ScreenUpdating = False
CurrentRowHeight = .RowHeight
ActiveCellWidth = ActiveCell.ColumnWidth
For Each CurrCell In Selection
MergedCellRgWidth = CurrCell.ColumnWidth + _
MergedCellRgWidth
Next
.MergeCells = False
.Cells(1).ColumnWidth = MergedCellRgWidth
.EntireRow.AutoFit
PossNewRowHeight = .RowHeight
.Cells(1).ColumnWidth = ActiveCellWidth
.MergeCells = True
.RowHeight = IIf(CurrentRowHeight PossNewRowHeight, _
CurrentRowHeight, PossNewRowHeight)
End If
End With
End If
End Sub

--
Regards,
Tom Ogilvy

"Roman Malakhovetskyy" wrote in
message ...
Using JScript.
I have merged some amount of cells and type some text in.
How can I to set autofit for text in merged cells



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 Merged cell Code is changing the format of my merged cells JB Excel Discussion (Misc queries) 0 August 20th 07 02:12 PM
Is there a way to Autofit Merged Cells in a row? JLSmith Excel Discussion (Misc queries) 2 August 1st 06 04:49 PM
Autofit Merged Cells in Excel kchambers Excel Discussion (Misc queries) 6 March 5th 05 04:57 PM
Autofit in Merged Cells? Mick Excel Discussion (Misc queries) 4 February 14th 05 05:15 PM
How do I "Wrap Text" & "Autofit" within Merged Cells in Excel? 6-shooter Excel Worksheet Functions 3 October 31st 04 12:14 AM


All times are GMT +1. The time now is 12:16 AM.

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

About Us

"It's about Microsoft Excel"