Necesito copiar columnas pero no me funciona lo que programe

Hola Expertos me gustaría copiar ciertas columnas a otra hoja en este caso la hoja se llama "PDA", ese es el primer paso, de igual manera me gustaría como segundo paso copiar las mismas columnas a otro archivo excel en que la primera fila este definida con ciertos títulos. En fin este es el código que llevo, me funciona para la primera copia nada mas:

Sub Copiar_Columna()


Dim variable, variable1, variable2, variable3, variable4, variable5, variable6, variable7, variable8, variable9, variable10, variable11, variable12, variable13, variable14, variable15 As String


variable = Range("A6", Range("A1048576").End(xlUp)).Select
Range("A6", Range("A1048576").End(xlUp)).Copy
Sheets("PDA").Select
Range("AQ2").PasteSpecial
Application.CutCopyMode = False
Range("AQ2").Select


variable1 = Range("D6", Range("D1048576").End(xlUp)).Select
Range("D6", Range("D1048576").End(xlUp)).Copy
Sheets("PDA").Select
Range("J2").PasteSpecial
Application.CutCopyMode = False
Range("J2").Select


variable2 = Range("F6", Range("F1048576").End(xlUp)).Select
Range("F6", Range("F1048576").End(xlUp)).Copy
Sheets("PDA").Select
Range("B2").PasteSpecial
Application.CutCopyMode = False
Range("B2").Select


variable3 = Range("G6", Range("G1048576").End(xlUp)).Select
Range("G6", Range("G1048576").End(xlUp)).Copy
Sheets("PDA").Select
Range("AR2").PasteSpecial
Application.CutCopyMode = False
Range("AR2").Select


variable4 = Range("K6", Range("K1048576").End(xlUp)).Select
Range("K6", Range("K1048576").End(xlUp)).Copy
Sheets("PDA").Select
Range("G2").PasteSpecial
Application.CutCopyMode = False
Range("G2").Select


variable5 = Range("Y6", Range("Y1048576").End(xlUp)).Select
Range("Y6", Range("Y1048576").End(xlUp)).Copy
Sheets("PDA").Select
Range("I2").PasteSpecial
Application.CutCopyMode = False
Range("I2").Select


variable6 = Range("L6", Range("L1048576").End(xlUp)).Select
Range("L6", Range("L1048576").End(xlUp)).Copy
Sheets("PDA").Select
Range("D2").PasteSpecial
Application.CutCopyMode = False
Range("D2").Select


variable7 = Range("T6", Range("T1048576").End(xlUp)).Select
Range("T6", Range("T1048576").End(xlUp)).Copy
Sheets("PDA").Select
Range("AU2").PasteSpecial
Application.CutCopyMode = False
Range("AU2").Select


variable8 = Range("Z6", Range("Z1048576").End(xlUp)).Select
Range("Z6", Range("Z1048576").End(xlUp)).Copy
Sheets("PDA").Select
Range("K2").PasteSpecial
Application.CutCopyMode = False
Range("K2").Select


variable9 = Range("AB6", Range("AB1048576").End(xlUp)).Select
Range("AB6", Range("AB1048576").End(xlUp)).Copy
Sheets("PDA").Select
Range("L2").PasteSpecial
Application.CutCopyMode = False
Range("L2").Select


variable10 = Range("AF6", Range("AF1048576").End(xlUp)).Select
Range("AF6", Range("AF1048576").End(xlUp)).Copy
Sheets("PDA").Select
Range("AT2").PasteSpecial
Application.CutCopyMode = False
Range("AT2").Select


variable11 = Range("AP6", Range("AP1048576").End(xlUp)).Select
Range("AP6", Range("AP1048576").End(xlUp)).Copy
Sheets("PDA").Select
Range("AV2").PasteSpecial
Application.CutCopyMode = False
Range("AV2").Select


variable12 = Range("AR6", Range("AR1048576").End(xlUp)).Select
Range("AR6", Range("AR1048576").End(xlUp)).Copy
Sheets("PDA").Select
Range("AW2").PasteSpecial
Application.CutCopyMode = False
Range("AW2").Select


variable13 = Range("AU6", Range("AU1048576").End(xlUp)).Select
Range("AU6", Range("AU1048576").End(xlUp)).Copy
Sheets("PDA").Select
Range("N2").PasteSpecial
Application.CutCopyMode = False
Range("N2").Select


variable14 = Range("BJ6", Range("BJ1048576").End(xlUp)).Select
Range("BJ6", Range("BJ1048576").End(xlUp)).Copy
Sheets("PDA").Select
Range("AX2").PasteSpecial
Application.CutCopyMode = False
Range("AX2").Select


variable15 = Range("BI6", Range("BI1048576").End(xlUp)).Select
Range("BI6", Range("BI1048576").End(xlUp)).Copy
Sheets("PDA").Select
Range("AY2").PasteSpecial
Application.CutCopyMode = False
Range("AY2").Select
End Sub

1 Respuesta

Respuesta
1

Sube tu archivo desde http://www.progranarexcel.com/p/contacto.html. te lo devuelvo con la solución y de paso te simplifico el código. Pon que la pregunta es de esta pagina para identificarla y describe en deTalle lo que necesitas con ej si es posibLe de Como deberían quedar los datos.

VIsita http://programarexcel.com/ ahi eNvontraras ejemplos que puedes adaptar

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas