Auto ajustar texto

16/01/2006 - 12:29 por Alejandro | Informe spam
Que tal.. tengo un libro en el cual relleno algunos datos en la 1º hoja y
automáticamente me llena en otras hojas lo mismo. Lo que me gustaría es que
automáticamente me ajuste el tamaño de la fila (no de la columna) para que
se vea todo el texto en todas las hojas. Ya seleccioné la celda y en formato
de celdas marqué Ajustar Texto, pero no lo hace automáticamente. Por ello
tengo q ir a cada hoja y darle doble click a la parte inferior del
encabezado de fila para q me ajuste. Cómo lo puedo hacer automáticamente???
Muchas gracias

Preguntas similare

Leer las respuestas

#6 KL
19/01/2006 - 15:06 | Informe spam
He mirado el codigo de Fernando Arroyo ma detenidamente y creo yo me decantaria por el de Jim Rech modificado por Dave Peterson y
ligeramente adaptado por un servidor (a continuacion) que me parece mas universal:

Sub AutoFitMergedCellRowHeight()
Dim CurrentRowHeight As Single, MergedCellRgWidth As Single
Dim CurrCell As Range, myActiveCell As Range
Dim ActiveCellWidth As Single, PossNewRowHeight As Single
Dim iX As Integer
Set myActiveCell = ActiveCell
If myActiveCell.MergeCells Then
With myActiveCell.MergeArea
If .Rows.Count = 1 And .WrapText = True Then
Application.ScreenUpdating = False
CurrentRowHeight = .RowHeight
ActiveCellWidth = myActiveCell.ColumnWidth
For Each CurrCell In myActiveCell.MergeArea
MergedCellRgWidth = CurrCell.ColumnWidth + _
MergedCellRgWidth
iX = iX + 1
Next
MergedCellRgWidth = MergedCellRgWidth + (iX - 1) * 0.71
.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


Saludos,
KL
Respuesta Responder a este mensaje
#7 Alejandro
19/01/2006 - 16:54 | Informe spam
Pegue el codigo que me dijiste en un modulo de visual, pero como lo hago
funcionar para un fila determinada?? Disculpa mi ignorancia. Muchas gracias


"KL" escribio en el mensaje
news:%
He mirado el codigo de Fernando Arroyo ma detenidamente y creo yo me
decantaria por el de Jim Rech modificado por Dave Peterson y ligeramente
adaptado por un servidor (a continuacion) que me parece mas universal:

Sub AutoFitMergedCellRowHeight()
Dim CurrentRowHeight As Single, MergedCellRgWidth As Single
Dim CurrCell As Range, myActiveCell As Range
Dim ActiveCellWidth As Single, PossNewRowHeight As Single
Dim iX As Integer
Set myActiveCell = ActiveCell
If myActiveCell.MergeCells Then
With myActiveCell.MergeArea
If .Rows.Count = 1 And .WrapText = True Then
Application.ScreenUpdating = False
CurrentRowHeight = .RowHeight
ActiveCellWidth = myActiveCell.ColumnWidth
For Each CurrCell In myActiveCell.MergeArea
MergedCellRgWidth = CurrCell.ColumnWidth + _
MergedCellRgWidth
iX = iX + 1
Next
MergedCellRgWidth = MergedCellRgWidth + (iX - 1) * 0.71
.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


Saludos,
KL


Respuesta Responder a este mensaje
#8 Alejandro
19/01/2006 - 17:59 | Informe spam
Lo que hice fue colocar un boton y me tengo q posicionar en la celda que
quiero justificar, lo ideal seria q fuera automatico pues son muchas hojas
en las q esta pegado el vinculo. Existe alguna forma de que ejecute
automaticamente la macro para una celda combinada en varias hojas ??? Muchas
gracias


"KL" escribio en el mensaje
news:%
He mirado el codigo de Fernando Arroyo ma detenidamente y creo yo me
decantaria por el de Jim Rech modificado por Dave Peterson y ligeramente
adaptado por un servidor (a continuacion) que me parece mas universal:

Sub AutoFitMergedCellRowHeight()
Dim CurrentRowHeight As Single, MergedCellRgWidth As Single
Dim CurrCell As Range, myActiveCell As Range
Dim ActiveCellWidth As Single, PossNewRowHeight As Single
Dim iX As Integer
Set myActiveCell = ActiveCell
If myActiveCell.MergeCells Then
With myActiveCell.MergeArea
If .Rows.Count = 1 And .WrapText = True Then
Application.ScreenUpdating = False
CurrentRowHeight = .RowHeight
ActiveCellWidth = myActiveCell.ColumnWidth
For Each CurrCell In myActiveCell.MergeArea
MergedCellRgWidth = CurrCell.ColumnWidth + _
MergedCellRgWidth
iX = iX + 1
Next
MergedCellRgWidth = MergedCellRgWidth + (iX - 1) * 0.71
.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


Saludos,
KL


Respuesta Responder a este mensaje
#9 KL
19/01/2006 - 18:14 | Informe spam
Hola Alejandro,

Si, se puede adaptar el codigo, pero lo podre hacer cuando vuelva a casa esta tarde, vale?

Saludos,
KL

"Alejandro" wrote in message news:
Lo que hice fue colocar un boton y me tengo q posicionar en la celda que
quiero justificar, lo ideal seria q fuera automatico pues son muchas hojas
en las q esta pegado el vinculo. Existe alguna forma de que ejecute
automaticamente la macro para una celda combinada en varias hojas ??? Muchas
gracias


"KL" escribio en el mensaje
news:%
He mirado el codigo de Fernando Arroyo ma detenidamente y creo yo me
decantaria por el de Jim Rech modificado por Dave Peterson y ligeramente
adaptado por un servidor (a continuacion) que me parece mas universal:

Sub AutoFitMergedCellRowHeight()
Dim CurrentRowHeight As Single, MergedCellRgWidth As Single
Dim CurrCell As Range, myActiveCell As Range
Dim ActiveCellWidth As Single, PossNewRowHeight As Single
Dim iX As Integer
Set myActiveCell = ActiveCell
If myActiveCell.MergeCells Then
With myActiveCell.MergeArea
If .Rows.Count = 1 And .WrapText = True Then
Application.ScreenUpdating = False
CurrentRowHeight = .RowHeight
ActiveCellWidth = myActiveCell.ColumnWidth
For Each CurrCell In myActiveCell.MergeArea
MergedCellRgWidth = CurrCell.ColumnWidth + _
MergedCellRgWidth
iX = iX + 1
Next
MergedCellRgWidth = MergedCellRgWidth + (iX - 1) * 0.71
.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


Saludos,
KL






Respuesta Responder a este mensaje
#10 Alejandro
19/01/2006 - 19:38 | Informe spam
Ok muchas gracias... espero tu respuesta


"KL" escribio en el mensaje
news:
Hola Alejandro,

Si, se puede adaptar el codigo, pero lo podre hacer cuando vuelva a casa
esta tarde, vale?

Saludos,
KL

"Alejandro" wrote in message
news:
Lo que hice fue colocar un boton y me tengo q posicionar en la celda que
quiero justificar, lo ideal seria q fuera automatico pues son muchas
hojas en las q esta pegado el vinculo. Existe alguna forma de que ejecute
automaticamente la macro para una celda combinada en varias hojas ???
Muchas gracias


"KL" escribio en el mensaje
news:%
He mirado el codigo de Fernando Arroyo ma detenidamente y creo yo me
decantaria por el de Jim Rech modificado por Dave Peterson y ligeramente
adaptado por un servidor (a continuacion) que me parece mas universal:

Sub AutoFitMergedCellRowHeight()
Dim CurrentRowHeight As Single, MergedCellRgWidth As Single
Dim CurrCell As Range, myActiveCell As Range
Dim ActiveCellWidth As Single, PossNewRowHeight As Single
Dim iX As Integer
Set myActiveCell = ActiveCell
If myActiveCell.MergeCells Then
With myActiveCell.MergeArea
If .Rows.Count = 1 And .WrapText = True Then
Application.ScreenUpdating = False
CurrentRowHeight = .RowHeight
ActiveCellWidth = myActiveCell.ColumnWidth
For Each CurrCell In myActiveCell.MergeArea
MergedCellRgWidth = CurrCell.ColumnWidth + _
MergedCellRgWidth
iX = iX + 1
Next
MergedCellRgWidth = MergedCellRgWidth + (iX - 1) * 0.71
.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


Saludos,
KL





Respuesta Responder a este mensaje
Ads by Google
Help Hacer una preguntaSiguiente AnteriorRespuesta Tengo una respuesta
Search Busqueda sugerida