Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Adatta altezza righe con unione celle

601 views
Skip to first unread message

Valerio

unread,
Oct 22, 2008, 12:19:02 PM10/22/08
to
Ciao, è possibile estendere ad una unione celle, la funzione di adatta
l'altezza delle righe?
Se lo faccio su una singola cella tutto bene, mentre su una unione celle
devo regolare l'altezza manualmente.
Grazie

brunob

unread,
Oct 23, 2008, 5:10:01 PM10/23/08
to

"Valerio" <Val...@discussions.microsoft.com> ha scritto nel messaggio
news:F982912C-A771-49EA...@microsoft.com...

Forse ti può aiutare questa routine:

Sub AutoFitMergedCellRowHeight()
'
'from:
http://www.exceltip.com/show_tip/Formating_in_VBA/Adjust_row_height_of_merged_cells_using_VBA_in_Microsoft_Excel/341.html
'
Dim CurrentRowHeight As Single, MergedCellRgWidth As Single
Dim ActiveCellWidth As Single, PossNewRowHeight As Single
Dim CurrCell As Range

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
Application.ScreenUpdating = True
End Sub


Seleziona le celle unite e lancia la routine: automaticamente il testo delle
celle unite viene giustificato e l'altezza aggiustata.
Se cerchi in questo forum il seguente messaggio:
From: =?Utf-8?B?cGF0cmlrMTEx?= <patr...@discussions.microsoft.com>
Subject: Adattamento automatico altezza riga non funziona su celle multiple
Date: Mon, 28 Jul 2008 03:46:01 -0700

troverai anche una soluzione modificata da Norman .
Se poi fai una ricerca con google sempre con questa routine come keyword
troverai parecchie altre risposte.
Fai sapere se risolvi.
Bruno

0 new messages