Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Row height and Merged Cells

Hi guys... heres the problem...

A2 contains a question number (short text)
B2 and C2 are merged and contain a question (long text)
The answer is going in Cell D2 (longest or medium length text)

As you are dealing with Merged Cells, auto row height format (ie double
clicking when the entire row) does not work. So double clicking on row
height arrows on row 2 would not solve the issue. I can manually select
row height to correctly space the question, but I have no idea how long
the answer will be, ie User could type a long answer in cell D2, and
Excel does not automatically adjust row height to answer cell.
Effectively row height needs to be greater of Question height (Merged B
and C) or Answer height (Row D)
All Cells are wrapped text.

There are lots of questions, and not practical for user to manually
resize.

Any ideas...?

Thanks

D



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Row height and Merged Cells



Tom....? :)

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Row height and Merged Cells

this code was previously posted by Jim Rech (also in KPMG) to address this
type problem. See if you can adjust it to your situation:

Jim Rech

Sub AutoFitMergedCellRowHeight()
Dim CurrentRowHeight As Single, MergedCellRgWidth As Single
Dim CurrCell As Range
Dim ActiveCellWidth As Single, PossNewRowHeight As Single
If ActiveCell.MergeCells Then
With ActiveCell.MergeArea
If .Rows.Count = 1 And .WrapText = True Then
Application.ScreenUpdating = False
CurrentRowHeight = .RowHeight
ActiveCellWidth = ActiveCell.ColumnWidth
For Each CurrCell In Selection
MergedCellRgWidth = CurrCell.ColumnWidth + _
MergedCellRgWidth
Next
.MergeCells = False
.Cells(1).ColumnWidth = MergedCellRgWidth
.EntireRow.AutoFit
PossNewRowHeight = .RowHeight
.Cells(1).ColumnWidth = ActiveCellWidth
.MergeCells = True
.RowHeight = IIf(CurrentRowHeight PossNewRowHeight, _
CurrentRowHeight, PossNewRowHeight)
End If
End With
End If
End Sub

--
Regards,
Tom Ogilvy

"Darin Kramer" wrote in message
...


Tom....? :)

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Row height and Merged Cells

Hi Tom,

I know its been a while on this query, but Im only getting to look at
the answer your proposed now. Good news is it works, BUT only if you
selec the exact cell which is the problematice one (ie the merged one)
How can I get it to run for all cells... ie look at all cells, and IF
its a merged one then run the macro...?

Really really appreciate your help.

Kind regards

Darin



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
Merged cells won't Autofit row height Hpyifur Excel Discussion (Misc queries) 27 May 20th 23 07:45 PM
Autofit Row Height of Merged Cells Jon Excel Discussion (Misc queries) 3 August 5th 05 08:15 PM
Autofit row height in merged cells BobT Excel Discussion (Misc queries) 1 February 25th 05 04:44 PM
Autofit of Row Height with Merged Cells - AGAIN! Paige Excel Programming 3 February 14th 05 06:59 PM
Row Height for merged cells Kaval Excel Programming 1 July 12th 04 04:26 AM


All times are GMT +1. The time now is 10:51 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"