Formateo de celdas con texto muy largo

el poder

Board Regular
Joined
Jul 14, 2002
Messages
62
Buenas a todos,

Quisiera me ayudaran con la siguiente hoja:

Resulta que tengo celdas con texto demasiado largo y para que se vea todo el texto, hay que juntar varias de ellas, sin embargo son cientos de registros que deben formatearse para que se pueda leer e imprimir todo el texto adecuadamente.

¿Habrá alguna macro que pueda identificar cuales son las celdas de más de 100 caracteres (por decir un número), y que inserte las celdas necesarias para que después se combinen automáticamente y se puedan imprimir todo el texto?

Sé que es mucho pedir, pero agradecería su ayuda.

Saludos
text.xls
BCDEFGHIJKLMNO
11NMEROCOLUMNABCOLUMNACCOLUMNADCOLUMNAECOLUMNAFCOLUMNAGCOLUMNAHCOLUMNAICOLUMNAJCOLUMNAKCOLUMNALCOLUMNAM
12Mf
13V.1JUEGOADMINISTRACINNUMERO4062FASFSF/04-12-012-02-5SEGUNDASALAREGIONALDEORIENTEDELTRIBUNALFEDERALDEJUSTICIAFISCALYADMNISTRATIVAENPEDLA,NY.MILENAFSFAFDASFIA&SYDS.A.DEC.V.REPORTEDEOBRFSAAPUBLICAAPRECIOSFASFDSUNITARIOSYTIEFMPOFDSAFASDETERMINADONUMERO99071-01FDSFXNOAPLICAXACTOR:FASFFASDMILENIA&SYDS.A.FDSADEC.V.VSDEMAFFNDADO:DELEGADFACIONVDECAMINFFDFDSAFSAFAOSYPUEESSDEINGRESOSYFDFOTROSASFD1.-LANULIDADFDSAFDELOFICIODCO-VAF-SDT-FARAFSDAC-2F00/04DEFECHA30DASFDEMARZODE200AF4,2.-ELPAGODEAGASTOFSDAFSFFAINANCIEROS;3.-PAGDFODENUEVOSCOSTOASINDIRECTOS,4.-PAFASGODENUEVOSCOSTOSDEFINANCIAMIENTOSDERIVADOSDELOSGASTOSDEEJECUCIONYADMINISTRACIONDELAOBRA,5.-ELABORACIONCONJUNTADELFINIQUITODEOBRA,6.-ELABORACIONDELACTAADMINISTRATIVADEEXTINCIONDEDERECHOSYOBLIGACIONES.SEENCUENTRAENFASFAPROCESODEADMISION,RECURFDSAFASSODEREVISINFSADPROPUESTOENGFGASGFCONTRADELASENTENCIAQGFAUEDECLARALANULIDADDELOFICIONOAPLICANOAPLICACONFECHA29DEMAYODE2005,SENOTIFICOSEFASFFDSANTENCIADEDIA10DELMISMOMESYAO,FDSAMEDIANTELACUALFAFSDADECLARALAFDNULIDADDELOFFICIODEFECHA30DEDFMARZODE2004,AFPARAQUESEDICTEUFANANUEVARESOLUCIFFONENRESPUESTAASDALESCRITODELAACTORADEFECHA8FDSAFASFDEMARZODE2004
14
15
16V.2JUCIOSFASDFASDCIVILEXPEDIENTE53/20FDASFADSFFSFSFFRADICFADFOENELJUZGDSAFADSFADFOPRIMDFSERODEDISTAFDSAFSDFDRITOENELESFDASTADODENEW /TD>FASFREPORTEDEOBRAPUBLICAAPRECIOSUNITARIOSYTIEMPODETERMINADONUMERO450fd0001322XNOAPLICAXACTOR:CONSTRUCTORANeeeAS.A.DEC.V.YMATAHERNANDEZTERCERMILENIOS.A.DEC.V.VS.DEMANDADO:CAPUFE1.-DEFSFSDCLARACIONJUDICIALFSFSFPARAQUEELCUMPLIMIEFSFSNTOALREPORTEDEFSFSOBRAPUBLICAYREFSFSDCTIFIQUELOSERRORFDSFSDFESDELPROYECTOFSFSFSFEJECUTIVOPARAQUFSFENYFSDFSDFSEREJECUTABLE;2.-FSFSDFSRECONOFSFSFSFSFFDSSFDCIMIENTODEQUEELGFDSFGDSGFGANTICIPOESTADEBIDAMENTEINVERTIDO,3.-RECONOCIMIENTOYPAGODELOSAJUSTESGASGGADECOSTOSPARALACONTINUACIONDELAOBRA,4.-RECONOCIMIENTOYPAGODEFDSFDSFFDSFMATERIALGASGDSAGAES.5.-PAGODEDAOSYPGAGASERJUEGOS,PAGODEGASTOSYCOSTAS,6.-INDEMNFASDFAIZACIONPORCONCEPTODEDAFASFFOMORAL,7.-LAACTUALIZACIONDETODOSLOSFSAFVALORESDESCRITOSHASTAELMOMENTODEQUESEHAGAEFECTIVALASENTENCIADEFINITIVA.SEGIROOFICIOALADIRECCIONGENERALDESERVICIOSPERICFSADFIALESDELAPGJAEFECTODEQUEDESIFASFDSGNEINGENIFASFADSEROCIVIL,AEFECTODEQUEACTUECOMOFASDFPERITOTERCCEROEFASFDAFNDISCORFSADFDIA(ETAPADEFASFDESAHOGODEPRUEBAS)NOAPLICANOAPLICASETRATADEUNSEGUNDOJUEGOPLANTEADFASFDASFFDAOPORLOSCONTRATISTAS,DADFSADFAOQUFASFDASFFSDAFFFSDAFEENELPRIMEFASFIDENTIFICADOCOFASFANELNUMERO7/2004DELMISMOJUZGADO,SOLICITOLFASFAARESCICIONDEDICHOREPORTE,LOQUENOJUSTIFIC.
17
18
DV
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Sí, Edit | Fill | Justify sería la manera más fácil. Pero favor sepa que si uno tiene más de 256 caracteres, se puede perder texto usando esto<sup>1</sup>.

Saludos,
Greg
<hr />
1. Hay que acreditar a GIA por esta información.
 
Upvote 0
Gracias Galileogali y Greg, ya lo intenté pero mi problema precisamente es como separar automaticamente en dos o mas celdas aquellas descripciones que pasen de 256 caracteres y que las divida en varias celdas hacia abajo respetando aquellas que son iguales o menores a esos caracteres.
 
Upvote 0
Navegando encontré algo similar a lo que necesito, sin embargo, me marca algunos errores: (Lo transcribo literalmente)
-----

Randy Harmelink:

I needed a "Long Justify" command a while back and did it a bit differently.

First, I go through the selected data and break each line into 255 byte or less portions (so that the EXCEL limitation is not exceeded). For each piece that exceeds 255 bytes, I insert a new column range identical to the original range width and place the overflow data there, then repeat until I reach the end of the selected range. Then I just run the normal justify function.

I actually have the overlay alert turned off, but it could be left on.

Code:
======================================================

Public Sub usJustifyWithLongText()

iRow = Selection.Row
iCol = Selection.Column
iRows = Selection.Rows.Count
iCols = Selection.Columns.Count
iEnd = iRow + iRows - 1

i1 = iRow
Do While i1 255 Then
Range(Cells(i1 + 1, iCol), Cells(i1 + 1, iCol + iCols - 1)).Insert Shift:=xlDown
iPos = InStrRev(Cells(i1, iCol).Value, " ", 255)
Cells(i1 + 1, iCol) = Mid(Cells(i1, iCol).Value, iPos + 1)
Cells(i1, iCol) = Mid(Cells(i1, iCol).Value, 1, iPos - 1)
iEnd = iEnd + 1
End If
i1 = i1 + 1
Loop

Range(Cells(iRow, iCol), Cells(iEnd, iCol + iCols - 1)).Select

Application.DisplayAlerts = False
Selection.Justify
Application.DisplayAlerts = True

Cells(iRow, iCol).Select

End Sub
 
Upvote 0
Poder,

Edité su mensaje para poner las etiquetas de "CODE". Pero siempre falta algo. Lo que pasa es sin las etiquetes si su VBA tiene un signo de "mayor que" or "menor que" se interpreta como HTML. Entonces favor revise lo que se ve aquí con lo que usted deseaba poner.

Atte,
 
Upvote 0
Listo Greg,

La cuestión es que al tratar de correrlo y depurarlo me marca "error de sintaxis" y sé que falta un if. Después de hacer varias pruebas marca a continuación un error de "argumento o llamada a procedimiento no válida".

Saludos
<font face=Courier New><SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Sub</SPAN> usJustifyWithLongText()

iRow = Selection.Row
iCol = Selection.Column
iRows = Selection.Rows.Count
iCols = Selection.Columns.Count
iEnd = iRow + iRows - 1

i1 = iRow
<SPAN style="color:#00007F">Do</SPAN> <SPAN style="color:#00007F">While</SPAN> i1 255 <SPAN style="color:#00007F">Then</SPAN>
Range(Cells(i1 + 1, iCol), Cells(i1 + 1, iCol + iCols - 1)).Insert Shift:=xlDown
iPos = InStrRev(Cells(i1, iCol).Value, " ", 255)
Cells(i1 + 1, iCol) = Mid(Cells(i1, iCol).Value, iPos + 1)
Cells(i1, iCol) = Mid(Cells(i1, iCol).Value, 1, iPos - 1)
iEnd = iEnd + 1
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN>
i1 = i1 + 1
<SPAN style="color:#00007F">Loop</SPAN>

Range(Cells(iRow, iCol), Cells(iEnd, iCol + iCols - 1)).Select

Application.DisplayAlerts = <SPAN style="color:#00007F">False</SPAN>
Selection.Justify
Application.DisplayAlerts = <SPAN style="color:#00007F">True</SPAN>

Cells(iRow, iCol).Select

End <SPAN style="color:#00007F">Sub</SPAN>
</FONT>
 
Upvote 0
Poder,

Hay algo faltando aquí:

Code:
Do While i1 .....
...... 255 Then

Hice una busqueda aquí para justify long text overlay y no me devuelve resultados. Asi que me parece que usted agarró este código de otro sitio. Mejor volver a tal sitio para ver si se encuentra la pieza faltante.
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,732
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top