Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Jen_G
 
Posts: n/a
Default Autofit doesn't work with merged cells

When I merge two cells together across columns & select wrap feature, the row
height doesn't adjust to accommodate all the words...even when I select
autofit. I have to manually drag the row number to see that all the words
show.
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Autofit doesn't work with merged cells

Yep.

Jim Rech wrote a macro called AutoFitMergedCellRowHeight that you may like:
http://groups.google.com/groups?thre...%40tkmsftngp05

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Jen_G wrote:

When I merge two cells together across columns & select wrap feature, the row
height doesn't adjust to accommodate all the words...even when I select
autofit. I have to manually drag the row number to see that all the words
show.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
Jen_G
 
Posts: n/a
Default Autofit doesn't work with merged cells

Appreciate the help...did get the macro to run, but the limitation to only
the active cell makes it too cumbersome for my needs. Thanks though...ugh!
I wish it worked.

"Dave Peterson" wrote:

Yep.

Jim Rech wrote a macro called AutoFitMergedCellRowHeight that you may like:
http://groups.google.com/groups?thre...%40tkmsftngp05

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Jen_G wrote:

When I merge two cells together across columns & select wrap feature, the row
height doesn't adjust to accommodate all the words...even when I select
autofit. I have to manually drag the row number to see that all the words
show.


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Autofit doesn't work with merged cells

Maybe you could just use Jim's code and loop through your cells.

Option Explicit
Sub testme()
Dim myCell As Range
Dim myRng As Range
Set myRng = Selection
For Each myCell In myRng.Cells
Application.Goto myCell
Call AutoFitMergedCellRowHeight
Next myCell
End Sub

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

Select range and run the macro that calls Jim's code.

Jen_G wrote:

Appreciate the help...did get the macro to run, but the limitation to only
the active cell makes it too cumbersome for my needs. Thanks though...ugh!
I wish it worked.

"Dave Peterson" wrote:

Yep.

Jim Rech wrote a macro called AutoFitMergedCellRowHeight that you may like:
http://groups.google.com/groups?thre...%40tkmsftngp05

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Jen_G wrote:

When I merge two cells together across columns & select wrap feature, the row
height doesn't adjust to accommodate all the words...even when I select
autofit. I have to manually drag the row number to see that all the words
show.


--

Dave Peterson


--

Dave Peterson
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
merged cells into one text cell, size varies dependant on text dat Jazzylady825 Excel Discussion (Misc queries) 0 December 9th 05 08:26 PM
Sorting Area with Merged Cells prizm1 New Users to Excel 3 September 10th 05 11:49 PM
Pasting into merged cells Jacques E. Bouchard Excel Discussion (Misc queries) 1 May 12th 05 03:27 AM
Row Autofit on Merged Cells Jluo Excel Discussion (Misc queries) 1 April 18th 05 02:37 PM
Charting of Merged Cells znb74 Excel Discussion (Misc queries) 0 April 15th 05 02:42 PM


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

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

About Us

"It's about Microsoft Excel"