A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

where text wraps in a cell, how can the row height be auto set?



 
 
Thread Tools Display Modes
  #21  
Old November 6th, 2009, 04:23 PM posted to microsoft.public.excel.worksheet.functions
Robert Cape Town
external usenet poster
 
Posts: 1
Default where text wraps in a cell, how can the row height be auto set



"Gord Dibben" wrote:

Plain and simple...................If you have merged cells in the range,
Autofit won't work even with wraptext enabled.

You will need the code if you insist upon using merged cells.

The developers added the merge cells feature in Excel 97 without thinking
about row autofit functionality.

Have not bothered to correct since.


Gord


On Tue, 29 Sep 2009 11:19:01 -0700, Redwren
wrote:

HELP! Just need to have rows auto fit contents (expand). Do not understand
the complicated code referenced in this post or even where to copy and insert
this code. Why doesn't the "Auto fit Row Height" option work under
formatting?

"Gord Dibben" wrote:

Make appropriate changes to the range in Greg's code.

Wrap Text rowautofit must be enabled to start with.

If stuck, please post details of your merged cells area(s)



Gord Dibben MS Excel MVP


On Mon, 27 Jul 2009 12:01:02 -0700, Linda B
wrote:


I have a row with merged cells and I am trying to get the height to
automatically adjust. How do I get this to happen?
Linda B.

"Greg Wilson" wrote:

Paste the following to the worksheet's code module. The code assumes that
each cell within A1:A10 is merged to adjacent columns as opposed to these
cells being merged - e.g. A11 are merged, A22 are merged, A33 are
merged etc. Change the range reference to suit. Can be a single cell.

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("A1:A10")
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

Alternatively, size the column width of a single cell in the same row to the
combined column widths of the merged range. Format the font, wraptext and
alignment exactly the same except change the font colour to be the same as
the background (to hide it). Enter a formula that references the active cell
of the merged range (e.g. "=C10"). Use the worksheet_change event to force
autofit of this cell. The merged cell range will then autofit along with it.
This assumes it is columns that are merged. Use the same logic if rows are
merged.

Regards,
Greg




"Stephen Sandor" wrote:

I have merged a number of cells and included text that wraps in the cell. Is
it possible to set the cell so that the height is automatically adjusted to
the height of the text?


I have carefully read through this discussion twice and I am no better off than when I started. There are obviously some very clever people trying their best to resolve a very simple problem. But clearly without success, as the same user problem is repeated many times. So to the basics.

Admit it, auto fit row height for a merged and wrapped cell (eg cells B5 to
J5) containing an unknown (and variable) number of charaters does not work,
has never worked.
Also, microsoft has known about this since 1997 or earlier.

As this is a pretty much basic function, microsoft must explain why it has
not been fixed.

It is all very well for the clever people to provide macro answers, but most
users do not know and do not use macros. So there has to be a better way that
the ordinary user can easily implement.

Notwithstanding the above, I am a low level macro user and the code provided
above baffles me. (MS Excel 2007)

I challenge microsoft to respond.


  #22  
Old January 22nd, 2010, 11:07 PM posted to microsoft.public.excel.worksheet.functions
Ruth
external usenet poster
 
Posts: 1
Default where text wraps in a cell, how can the row height be auto set?



"Stephen Sandor" wrote:

I have merged a number of cells and included text that wraps in the cell. Is
it possible to set the cell so that the height is automatically adjusted to
the height of the text?

  #23  
Old January 22nd, 2010, 11:10 PM posted to microsoft.public.excel.worksheet.functions
Ruth
external usenet poster
 
Posts: 1
Default where text wraps in a cell, how can the row height be auto set?

I had the same issue. I found a work around for my situation. I made the
column as wider instead of merging cells, then when you select wrap text the
automatic row height works. It may not work for all but does for me.

"Stephen Sandor" wrote:

I have merged a number of cells and included text that wraps in the cell. Is
it possible to set the cell so that the height is automatically adjusted to
the height of the text?

  #24  
Old January 23rd, 2010, 12:11 AM posted to microsoft.public.excel.worksheet.functions
Gord Dibben
external usenet poster
 
Posts: 20,252
Default where text wraps in a cell, how can the row height be auto set?

Ruth

Do you have a question about this previous post you tacked onto?

Short answer...............merged cells do not allow row autofit unless you
employ VBA event code.


Gord Dibben MS Excel MVP

On Fri, 22 Jan 2010 15:07:01 -0800, Ruth Ruth @discussions.microsoft.com
wrote:



"Stephen Sandor" wrote:

I have merged a number of cells and included text that wraps in the cell. Is
it possible to set the cell so that the height is automatically adjusted to
the height of the text?


  #25  
Old April 15th, 2010, 09:26 AM posted to microsoft.public.excel.worksheet.functions
Broughan
external usenet poster
 
Posts: 1
Default where text wraps in a cell, how can the row height be auto set

It seems pretty silly that this is not intuitive. One way I know is highlight
all the rows, then on the left hand side of the spreadsheet, where the rows
are numbered double click with the left mouse button on the line between two
of the rows, and bingo


"Elso" wrote:

Hello

Would somebody mind to please explain this auto set row height in very
beginner terms? I am not in any way Excel Savvy. But I do have one very
simple project in Excel I am trying to complete. Very simply, I have a
"master" workbook that is to update other workbooks with exact text entered
in the master. No calculation or other fancy stuff, just the means of
entering text once and having it be copied to other workbooks. I am learning
as I go and for the most part I have a good handle on this simple process.
There are areas where an auto height adjustment of both the source field and
the targeted fields would be very useful. Cells do not need to be merged
cells. Simple copy/paste example would be greatly appreciated.
For an example that I could copy/past:
the source cell could be A19 and the target cell in a different workbook
could be B37.

Thank you for anyone who wishes to take the time to explain how this is put
into play
Nelson

"Gord Dibben" wrote:

If destination cell is set to wrap text and autofit you still have to
d-click on the bottom edge of the row header.

I don't know if the results of a formula will trigger the autofit.

Won't on my 2003 version.


Gord

On Fri, 1 Aug 2008 14:16:03 -0700, Terry H.
wrote:

Thanks. That makes sense, and I can probably set things up so there is a
single cell to a single cell linkage. So I think my question is really more
about the linkage between cells instead of the merging cells.

Let's say I have a worksheet tab for data entry (sheet1) that has a cell
linked to a cell in another tab (sheet2) - one cell linking to one cell. The
destination cell (in sheet2) will not autofit to the wrapped text. Instead,
I have to manually resize the row to see all of the entered text. Is there a
way to set it up so that if data is entered into the cell in sheet1 the cell
height in sheet2 automatically expands to accommodate all of the text without
a manual adjustment?

"Gord Dibben" wrote:

If you are linking a single cell in sheet1 to a merged cell on another sheet
the single cell is not merged so Greg's code will not work on it.

Regular wrap text and autofit should work on single cells in sheet1


Gord Dibben MS Excel MVP

On Fri, 1 Aug 2008 08:23:01 -0700, Terry H. Terry
wrote:

Hi Greg,

Great code! Works like a charm. I found an area where this does not appear
to work. Any help you can provide would be greatly appreciated. I have an
Excel spreadsheet where information is entered in cells on one tab. Those
cells are linked to merged cells on another tab. This code does not appear
to work when applied to the merged cells that are linked. Any way around
this? Thanks,

Terry

"Greg Wilson" wrote:

Paste the following to the worksheet's code module. The code assumes that
each cell within A1:A10 is merged to adjacent columns as opposed to these
cells being merged - e.g. A11 are merged, A22 are merged, A33 are
merged etc. Change the range reference to suit. Can be a single cell.

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("A1:A10")
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

Alternatively, size the column width of a single cell in the same row to the
combined column widths of the merged range. Format the font, wraptext and
alignment exactly the same except change the font colour to be the same as
the background (to hide it). Enter a formula that references the active cell
of the merged range (e.g. "=C10"). Use the worksheet_change event to force
autofit of this cell. The merged cell range will then autofit along with it.
This assumes it is columns that are merged. Use the same logic if rows are
merged.

Regards,
Greg




"Stephen Sandor" wrote:

I have merged a number of cells and included text that wraps in the cell. Is
it possible to set the cell so that the height is automatically adjusted to
the height of the text?




  #26  
Old May 7th, 2010, 06:04 PM posted to microsoft.public.excel.worksheet.functions
sg
external usenet poster
 
Posts: 61
Default where text wraps in a cell, how can the row height be auto set

Thanks Ruth. I tried this and it worked for me. I unmerged the cells and
then double clicked for auto row height and it worked.

"Ruth" wrote:

I had the same issue. I found a work around for my situation. I made the
column as wider instead of merging cells, then when you select wrap text the
automatic row height works. It may not work for all but does for me.

"Stephen Sandor" wrote:

I have merged a number of cells and included text that wraps in the cell. Is
it possible to set the cell so that the height is automatically adjusted to
the height of the text?

  #27  
Old May 10th, 2010, 07:57 PM posted to microsoft.public.excel.worksheet.functions
angie
external usenet poster
 
Posts: 314
Default where text wraps in a cell, how can the row height be auto set

I need help for a very similar problem:

NO merged cells
NO specialized formatting, and format is consistent across spreadsheet
cells are set to "wrap text"

When I click on "autofit row height", 90% of the rows become the correct
height, while 10% do not. I have a few thousand rows of data, and 26 columns
with varying amounts of text in them. Sometimes the row becomes too short,
sometimes too tall, and it can happen no matter how much or how little text
is in it.

Can I repeat that I DO NOT have any merged cells? I have searched online
for hours and no one seems to have an explanation or a solution.
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Feedback on table setup Little Penny Database Design 1 December 28th, 2005 11:32 AM
Word applies direct format on File open Uriel General Discussion 16 November 27th, 2005 07:22 PM
Add New Field to DB Karen Database Design 7 October 19th, 2005 08:03 PM
Possible Lookup Table Karen Worksheet Functions 5 June 8th, 2005 09:43 PM
Change font of part of text John Powerpoint 7 March 15th, 2005 10:10 AM


All times are GMT +1. The time now is 08:39 PM.


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