PC Review


Reply
Thread Tools Rate Thread

Autofit rows where a cell contains results of formula

 
 
=?Utf-8?B?R2VvZmYgQw==?=
Guest
Posts: n/a
 
      6th Jul 2007
I have a column of cells in a new worksheet. Each cell has a formula that
concatenates data from several cells in the corresponding row of another
worksheet, and results in a comment ranging from 12 characters to around
about 160.

I need my new sheet to autofit the rows, since the longer text strings
overflow the fixed column space. However, they don't do this
automatically,even though I have formatted the cells as "Wrap", and have
already formatted the rows as autofit. I have to manually select all rows and
format them as autofit again, presumably because the strings are the results
of formulae, rather than entered text. Because it occasionally cuts off at a
point where you can't tell that there is overflow text, I need this autofit
to be automatic. Can this be done?

Any suggestions gratefully received,
Geoff
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      6th Jul 2007
Maybe you can tie into that worksheet's calculation event to resize the rows.

If you want to try, right click on the worksheet that should have this
behavior. Select View code. Paste this into the code window:

Option Explicit
Private Sub Worksheet_Calculate()
application.enableevents = false
Me.Rows.AutoFit
'or be specific
Me.Rows("1:33").AutoFit
application.enableevents = true
End Sub

Changing the rowheight in some versions of excel (xl2003+, IIRC) will cause the
excel to want to recalc again. The .enableevents stuff stops excel from going
into a loop--recalc, loop, recalc, loop, ....

Geoff C wrote:
>
> I have a column of cells in a new worksheet. Each cell has a formula that
> concatenates data from several cells in the corresponding row of another
> worksheet, and results in a comment ranging from 12 characters to around
> about 160.
>
> I need my new sheet to autofit the rows, since the longer text strings
> overflow the fixed column space. However, they don't do this
> automatically,even though I have formatted the cells as "Wrap", and have
> already formatted the rows as autofit. I have to manually select all rows and
> format them as autofit again, presumably because the strings are the results
> of formulae, rather than entered text. Because it occasionally cuts off at a
> point where you can't tell that there is overflow text, I need this autofit
> to be automatic. Can this be done?
>
> Any suggestions gratefully received,
> Geoff


--

Dave Peterson
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting rows to autofit wrapping text in a cell John Microsoft Excel Misc 1 8th Jan 2010 12:22 AM
Rows().AutoFit starts a calculation, but Columns().AutoFit doesn't Stefano Microsoft Excel Programming 1 30th Nov 2009 05:01 PM
RE: Rows().AutoFit starts a calculation, but Columns().AutoFit doesn't Mike H Microsoft Excel Programming 0 25th Nov 2009 04:31 PM
In Excel, how to autofit for results of a formula =?Utf-8?B?amtzY2FyZA==?= Microsoft Excel Misc 0 15th Aug 2006 05:44 PM
Hiding formula results when blank cell within formula Michael J. Malinsky Microsoft Excel Worksheet Functions 4 31st Mar 2004 04:06 PM


Features
 

Advertising
 

Newsgroups
 


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