Jump to content

error en el metodo select de la clase Range


Recommended Posts

Saludos,

intento simplemente crear un macro para copiar y pegar celdas de dos hojas diferentes desde la ultima celda vacia.. "es mi primer macro"

Sub nuevos()

Dim ultimafila As Long

ultimafila = Sheets("Hoja2").Range("B20000").End(xlUp).Row

ultimafila = ultimafila + 1

Sheets("FORMATO").Range("K13").Copy

Sheets("Hoja2").Cells(ultimafila, 2).Select en esta linea presenta el error

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _

:=False, Transpose:=False

Sheets("FORMATO").Range("K15").Copy

Sheets("Hoja2").Cells(ultimafila, 4).Select

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _

:=False, Transpose:=False

me podrian guiar un poco.. gracias.

Link to comment
Share on other sites

Sub nuevos()

Dim ultimafila As Long
Dim Origen As Worksheet, Destino As Worksheet


Set Origen = Sheets("FORMATO")
Set Destino = Sheets("Hoja2")


ultimafila = Sheets("Hoja2").Range("B" & Rows.Count).End(xlUp).Row + 1


Destino.Range("B" & ultimafila) = Origen.Range("K13")
Destino.Range("C" & ultimafila) = Origen.Range("Q15")
Destino.Range("D" & ultimafila) = Origen.Range("D43")
'etc...


End Sub


[/CODE]

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

Privacy Policy