Consulting

Results 1 to 4 of 4

Thread: shift on copy or paste

  1. #1
    VBAX Mentor Sir Babydum GBE's Avatar
    Joined
    Mar 2005
    Location
    Cardiff, UK
    Posts
    499
    Location

    shift on copy or paste

    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.
    Have a profound problem? Need a ridiculous solution? Post a question in Babydum's forum

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    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
    [/vba]

    The first two do the work, the third setsup the control keys.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Mentor Sir Babydum GBE's Avatar
    Joined
    Mar 2005
    Location
    Cardiff, UK
    Posts
    499
    Location
    Marvellous,

    Thanks Mr X
    Have a profound problem? Need a ridiculous solution? Post a question in Babydum's forum

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Don't forget to reset the keys when done!
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •