Excel - transponer tablas grandes

 
Vista:
Imágen de perfil de guihe

transponer tablas grandes

Publicado por guihe (38 intervenciones) el 25/05/2009 10:56:24
Hola a todos,
tengo en la hoja1 una tabla de 299 x 38 (fila x columna) y la quería transponer con una macro. Utilizo Excel 2003 y sé que no cabe pero quería exportarla a un archivo de texto *.txt. El código que he escrito lo transcribo abajo, pero me da un error en la linea de 'Print' que dice 'Error definido por la aplicación o el objeto'
Muchas gracias a todos
CODIGO:
Sub transponer()
nfil = Range("A65536").End(xlUp).Row
ncol = Range("IV1").End(xlToLeft).Column
Dim nua
ruta = ThisWorkbook.Path
nua = FreeFile
lista = ruta & "prueba.txt"
Open lista For Output As #nua
For b = 1 To nfil
Print #nua, Cells(1, b) & " " & Cells(2, b) & " " & Cells(3, b) & " " & Cells(4, b), Cells(5, b) & " " & Cells(6, b) & " " & Cells(7, b) & " " & Cells(8, b) _
; Cells(9, b) & " " & Cells(10, b) & " " & Cells(11, b) & " " & Cells(12, b), Cells(13, b) & " " & Cells(14, b) & " " & Cells(15, b) & " " & Cells(16, b) _
; Cells(17, b) & " " & Cells(18, b) & " " & Cells(19, b) & " " & Cells(20, b), Cells(21, b) & " " & Cells(22, b) & " " & Cells(23, b) & " " & Cells(24, b) _
; Cells(25, b) & " " & Cells(26, b) & " " & Cells(27, b) & " " & Cells(28, b), Cells(29, b) & " " & Cells(30, b) & " " & Cells(31, b) & " " & Cells(32, b) _
; Cells(33, b) & " " & Cells(34, b) & " " & Cells(35, b) & " " & Cells(36, b), Cells(37, b) & " " & Cells(38, b)
Next b
Close #nua
End
End Sub
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder