Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 158
Default Autofit row height when retrieving text via formula

After reading through all the row height responses (most of which address
mergred cells - not my issue), I don't see where this has been addressed. I
have a formula that can retrieve a highly variable amount of text. Since
that cell is never directly edited, it does not trigger autofit to resize the
row height. If I double-click on the lower border of the row, or invoke
Autofit manually, it does resize the row. But I need that to happen
automatically (so I don't get calls from users telling me that text is
missing). This could make the solution easier: all the changes that would
increase/decrease the amount of text in the cell happen on another worksheet,
so maybe all I need is an event macro that invokes Autofit when returning to
the target sheet.

I am using xl2003, and the target sheet is password protected.

TIA
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Autofit row height when retrieving text via 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, ....

andy62 wrote:

After reading through all the row height responses (most of which address
mergred cells - not my issue), I don't see where this has been addressed. I
have a formula that can retrieve a highly variable amount of text. Since
that cell is never directly edited, it does not trigger autofit to resize the
row height. If I double-click on the lower border of the row, or invoke
Autofit manually, it does resize the row. But I need that to happen
automatically (so I don't get calls from users telling me that text is
missing). This could make the solution easier: all the changes that would
increase/decrease the amount of text in the cell happen on another worksheet,
so maybe all I need is an event macro that invokes Autofit when returning to
the target sheet.

I am using xl2003, and the target sheet is password protected.

TIA


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 158
Default Autofit row height when retrieving text via formula

Thanks, Dave. That works great. At first, with the target worksheet
protected, I was getting a runtime error, but I realized I needed to "allow
row formatting" under the protection settings.

"Dave Peterson" wrote:

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, ....

andy62 wrote:

After reading through all the row height responses (most of which address
mergred cells - not my issue), I don't see where this has been addressed. I
have a formula that can retrieve a highly variable amount of text. Since
that cell is never directly edited, it does not trigger autofit to resize the
row height. If I double-click on the lower border of the row, or invoke
Autofit manually, it does resize the row. But I need that to happen
automatically (so I don't get calls from users telling me that text is
missing). This could make the solution easier: all the changes that would
increase/decrease the amount of text in the cell happen on another worksheet,
so maybe all I need is an event macro that invokes Autofit when returning to
the target sheet.

I am using xl2003, and the target sheet is password protected.

TIA


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Autofit row height when retrieving text via formula

You could have added a line to unprotect the sheet, resize the row heights, and
reprotect the worksheet--useful if you were using xl2k and earlier.

andy62 wrote:

Thanks, Dave. That works great. At first, with the target worksheet
protected, I was getting a runtime error, but I realized I needed to "allow
row formatting" under the protection settings.

"Dave Peterson" wrote:

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, ....

andy62 wrote:

After reading through all the row height responses (most of which address
mergred cells - not my issue), I don't see where this has been addressed. I
have a formula that can retrieve a highly variable amount of text. Since
that cell is never directly edited, it does not trigger autofit to resize the
row height. If I double-click on the lower border of the row, or invoke
Autofit manually, it does resize the row. But I need that to happen
automatically (so I don't get calls from users telling me that text is
missing). This could make the solution easier: all the changes that would
increase/decrease the amount of text in the cell happen on another worksheet,
so maybe all I need is an event macro that invokes Autofit when returning to
the target sheet.

I am using xl2003, and the target sheet is password protected.

TIA


--

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
Autofit for row height is not working. Why? Leo Excel Discussion (Misc queries) 3 July 28th 08 06:43 PM
Autofit row height Odie Excel Discussion (Misc queries) 7 April 12th 08 07:25 PM
Need a row to autofit height after it's value changes Rob E[_2_] Excel Discussion (Misc queries) 6 June 20th 07 08:00 PM
Possible to automatically autofit row height to text in Excel? PSIUser Excel Discussion (Misc queries) 0 June 27th 06 08:53 PM
Autofit Row Height MarkN Excel Discussion (Misc queries) 0 November 21st 05 03:38 AM


All times are GMT +1. The time now is 06:23 PM.

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

About Us

"It's about Microsoft Excel"