#1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
sacrum
 
Posts: n/a
Default Auto size help

I have a feature in my workbook that produces a report view on one worksheet
by copying certain data fields into labelled cells. One receiving cell is
comprised of merged cells - when it receives text/data only some of it is
visible as the cell is too small - tried several things to no avail. Is
there a for the labelled cell to auto fit the the received data or is this
limited by excel?

Tia


  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
Tom Ogilvy
 
Posts: n/a
Default Auto size help

Merged cells don't autofit. You might look at this code previously posted
by Jim Rech:

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


"sacrum" wrote in message
...
I have a feature in my workbook that produces a report view on one

worksheet
by copying certain data fields into labelled cells. One receiving cell is
comprised of merged cells - when it receives text/data only some of it is
visible as the cell is too small - tried several things to no avail. Is
there a for the labelled cell to auto fit the the received data or is this
limited by excel?

Tia




  #3   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
sacrum
 
Posts: n/a
Default Auto size help

Hi Tom,

I'm having rpoblems with the script....

My worksheet has a sub called Form which extracts choice and put onto form.

The merged cells are in worksheet set as wrep and are labelled RepRiskDetail

Would you kindly help me put that context into the script you posted?
Ideally I would want this function within the sub form.

Chris

"Tom Ogilvy" wrote in message
...
Merged cells don't autofit. You might look at this code previously posted
by Jim Rech:

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


"sacrum" wrote in message
...
I have a feature in my workbook that produces a report view on one

worksheet
by copying certain data fields into labelled cells. One receiving cell
is
comprised of merged cells - when it receives text/data only some of it is
visible as the cell is too small - tried several things to no avail. Is
there a for the labelled cell to auto fit the the received data or is
this
limited by excel?

Tia






  #4   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
Tom Ogilvy
 
Posts: n/a
Default Auto size help

Sub AutoFitMergedCellRowHeight()
Dim CurrentRowHeight As Single, MergedCellRgWidth As Single
Dim CurrCell As Range
Dim ActiveCellWidth As Single, PossNewRowHeight As Single
' add this line:
Range("RepRiskDetail").Select
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


"sacrum" wrote in message
...
Hi Tom,

I'm having rpoblems with the script....

My worksheet has a sub called Form which extracts choice and put onto

form.

The merged cells are in worksheet set as wrep and are labelled

RepRiskDetail

Would you kindly help me put that context into the script you posted?
Ideally I would want this function within the sub form.

Chris

"Tom Ogilvy" wrote in message
...
Merged cells don't autofit. You might look at this code previously

posted
by Jim Rech:

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


"sacrum" wrote in message
...
I have a feature in my workbook that produces a report view on one

worksheet
by copying certain data fields into labelled cells. One receiving cell
is
comprised of merged cells - when it receives text/data only some of it

is
visible as the cell is too small - tried several things to no avail.

Is
there a for the labelled cell to auto fit the the received data or is
this
limited by excel?

Tia








  #5   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
sacrum
 
Posts: n/a
Default Auto size help

Thanjks Tom - all is working well now.


"Tom Ogilvy" wrote in message
...
Sub AutoFitMergedCellRowHeight()
Dim CurrentRowHeight As Single, MergedCellRgWidth As Single
Dim CurrCell As Range
Dim ActiveCellWidth As Single, PossNewRowHeight As Single
' add this line:
Range("RepRiskDetail").Select
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


"sacrum" wrote in message
...
Hi Tom,

I'm having rpoblems with the script....

My worksheet has a sub called Form which extracts choice and put onto

form.

The merged cells are in worksheet set as wrep and are labelled

RepRiskDetail

Would you kindly help me put that context into the script you posted?
Ideally I would want this function within the sub form.

Chris

"Tom Ogilvy" wrote in message
...
Merged cells don't autofit. You might look at this code previously

posted
by Jim Rech:

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


"sacrum" wrote in message
...
I have a feature in my workbook that produces a report view on one
worksheet
by copying certain data fields into labelled cells. One receiving
cell
is
comprised of merged cells - when it receives text/data only some of it

is
visible as the cell is too small - tried several things to no avail.

Is
there a for the labelled cell to auto fit the the received data or is
this
limited by excel?

Tia










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
Print Excel charts in Word 2003 with fixed size Phil Charts and Charting in Excel 1 November 3rd 05 04:24 AM
Combo Box font size in Charts Shirley Munro Charts and Charting in Excel 0 October 27th 05 12:38 PM
It auto changes font size on e-mail entries, WHY? donnaemi Excel Discussion (Misc queries) 2 July 27th 05 02:21 PM
Font size prints same size regardless of how I set it in Excel Marcusmouse Excel Discussion (Misc queries) 2 May 26th 05 03:25 PM
excel links update not working in auto, calculations in auto Mikey Boy Excel Worksheet Functions 0 December 7th 04 11:53 PM


All times are GMT +1. The time now is 05:30 AM.

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"