ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Autofit merged cells with wrapped text (https://www.excelbanter.com/excel-programming/302366-re-autofit-merged-cells-wrapped-text.html)

Dave Peterson[_3_]

Autofit merged cells with wrapped text
 
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

Ivan wrote:

Hi,

I have a cell, which is merged from more cells. I have a text within this cell, which is wider than width of this cell (merged cells). The text wrap flag is set, so text is wrapping and have more than one row (only first is visible). I need to autofit this cell (row) as single-cell does, when the text is wider and text wrap flag is set. Or I'd like to get the number of the rows of the text.

Thanks for any help.


--

Dave Peterson


Mere

Autofit merged cells with wrapped text
 
That worked well but I have a whole spreadsheet that I want to be able to
adjust rather than just individual cells. Is there a macro that will enable
me to apply this to an entire worksheet or at least a section of selected
rows?

Thank you!



"Dave Peterson" wrote:

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

Ivan wrote:

Hi,

I have a cell, which is merged from more cells. I have a text within this cell, which is wider than width of this cell (merged cells). The text wrap flag is set, so text is wrapping and have more than one row (only first is visible). I need to autofit this cell (row) as single-cell does, when the text is wider and text wrap flag is set. Or I'd like to get the number of the rows of the text.

Thanks for any help.


--

Dave Peterson



Dave Peterson[_5_]

Autofit merged cells with wrapped text
 
You could select your cells that you want fixed and then run the macro against
each of those cells:

Kind of:

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

(with Jim's original code here!)

Mere wrote:

That worked well but I have a whole spreadsheet that I want to be able to
adjust rather than just individual cells. Is there a macro that will enable
me to apply this to an entire worksheet or at least a section of selected
rows?

Thank you!


"Dave Peterson" wrote:

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

Ivan wrote:

Hi,

I have a cell, which is merged from more cells. I have a text within this cell, which is wider than width of this cell (merged cells). The text wrap flag is set, so text is wrapping and have more than one row (only first is visible). I need to autofit this cell (row) as single-cell does, when the text is wider and text wrap flag is set. Or I'd like to get the number of the rows of the text.

Thanks for any help.


--

Dave Peterson



--

Dave Peterson


All times are GMT +1. The time now is 10:32 AM.

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