Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Autofit rows where a cell contains results of formula

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Autofit rows where a cell contains results of formula

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
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
Setting rows to autofit wrapping text in a cell John Excel Discussion (Misc queries) 1 January 8th 10 12:22 AM
In Excel, how to autofit for results of a formula jkscard Excel Discussion (Misc queries) 0 August 15th 06 05:44 PM
Visualize results of a custom formula array 1818 rows Ger[_3_] Excel Programming 0 June 5th 06 07:33 AM
Visualize results of a custom formula array 1818 rows Ger[_3_] Excel Programming 0 June 5th 06 07:20 AM
can't format rows to autofit jbf Excel Discussion (Misc queries) 2 January 21st 06 11:54 PM


All times are GMT +1. The time now is 12:27 PM.

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"