Saltar al contenido

Automatizar copy/paste

publicado

____________________________________________________________

Hola a todos:

Producto del aburrimiento me ha salido esto.

Para aquellos que teneis que hacer mucho copy/paste os dejo estas cuatro líneas de código.

Colocarlas en la hoja deseada y:

Seleccionar un rango + click derecho en la selección + clic en la celda de destino.

________________________________________________________

Dim Switch As Boolean

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
Selection.Copy
Switch = True
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Switch = True Then
Target.PasteSpecial
Application.CutCopyMode = xlCut
Switch = False
End If
End Sub
[/CODE]

Paz, amor y algo de pasta, que tampoco viene mal.

[b]________________________________________________________[/b]

[/color][/b]

Featured Replies

  • 8 months later...
publicado

Como lo deberia de ingresar en el Excel? me podrias indicar por favor?

disculpa las molestias!

publicado

Macro

Esta muy bueno tu aporte muchas gracias por compartir vuestros conocimientos.

Me permito agregar algo, muy mínimo, espero sea de utilidad.

Agrego que al momento de pegar solo pegue valores.

Dim Switch As Boolean

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
Selection.Copy
Switch = True
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Switch = True Then
Target.PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = xlCut
Switch = False
End If
End Sub
[/CODE]

Saludos Cordiales

Pedro Venegas

Archivado

Este tema está ahora archivado y está cerrado a más respuestas.