PDA

View Full Version : shift on copy or paste



Sir Babydum GBE
10-23-2007, 05:00 AM
How do I do this please?

So I press Ctrl & C, the cell copies and then shifts two to the left - also when i press CTRL & V, it pastes then shifts one to the right.

Thanks.

Bob Phillips
10-23-2007, 05:11 AM
Sub CopyAndMove()
With ActiveCell
.Copy
If .Column >= 3 Then
.Offset(0, -2).Select
ElseIf .Column >= 2 Then
.Offset(0, -1).Select
End If
End With
End Sub

Sub PasteAndMove()
With ActiveSheet
.Paste
If ActiveCell.Column <= .Columns.Count - 1 Then
ActiveCell.Offset(0, 1).Select
End If
Application.CutCopyMode = False
End With
End Sub

Sub SetKeys()
Application.OnKey "^c", "CopyAndMove"
Application.OnKey "^v", "PasteAndMove"
End Sub


The first two do the work, the third setsup the control keys.

Sir Babydum GBE
10-23-2007, 05:33 AM
Marvellous,

Thanks Mr X

Bob Phillips
10-23-2007, 05:35 AM
Don't forget to reset the keys when done!