Results 1 to 6 of 6
  1. #1
    Lounger
    Join Date
    Apr 2005
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    Hello Everyone,

    I am looking for a method to pick the second latest copy item from clipboard for pasting at desired location.
    We have designed a workbook which keeps track of the navigation history for that we insert a row in a sheet and write the name of the active sheet.
    My problem, when I have to copy something from Sheet1 to sheet2, as I move to sheet2 inbetween the navigation function works and I am unable to paste copied cell(s). I know that we can have that data in clipboard. So is there anyway we can retrive that data from clipboard thrugh VBA code?

    Thanks in advance

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Unfortunately, there is no support for the multi-item Office Clipboard in VBA.

    You could keep track of the address or row number of the data in a variable, and use that to copy the correct information.
    The exact details would depend on the code you already have, so if you want more help, please provide some details.

  3. #3
    New Lounger
    Join Date
    Sep 2009
    Location
    India
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    [quote name='HansV' post='793686' date='17-Sep-2009 15:23']Unfortunately, there is no support for the multi-item Office Clipboard in VBA.

    You could keep track of the address or row number of the data in a variable, and use that to copy the correct information.
    The exact details would depend on the code you already have, so if you want more help, please provide some details.[/quote]

    Hans, actually when we copy something using ctrl + c but before pasting if we insert a row we lose the ability to paste ( ctrl + v) but it remains in the clipboard.
    It will be a great help if you can tell me how to copy it from clip board using VBA, if there is anyway for it.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    [quote name='bharatjain' post='793689' date='17-Sep-2009 12:36']Hans, actually when we copy something using ctrl + c but before pasting if we insert a row we lose the ability to paste ( ctrl + v) but it remains in the clipboard.[/quote]
    I know, but VBA cannot get at the value on the Office Clipboard - Microsoft omitted to add that capability.

    You could change the order: first insert a row, then copy/paste. The latter can be done in one step in VBA:

    Dim s As Long
    Dim t As Long
    s = 5 ' You'd compute these
    t = 13
    Worksheets("Sheet1").Range("A" & s & ":N" & s).Copy Destination:=Worksheets("Sheet2").Range("A" & t)

  5. #5
    3 Star Lounger
    Join Date
    Feb 2003
    Location
    Runcorn, Cheshire, United Kingdom
    Posts
    372
    Thanks
    0
    Thanked 2 Times in 2 Posts
    [quote name='bharatjain' post='793689' date='17-Sep-2009 11:36']Hans, actually when we copy something using ctrl + c but before pasting if we insert a row we lose the ability to paste ( ctrl + v) but it remains in the clipboard.
    It will be a great help if you can tell me how to copy it from clip board using VBA, if there is anyway for it.[/quote]

    Is there an equivalent you can do to selecting the text within the cell (in the same way as you would do if you hit F2 and dragged the selection across the contents) before copying it?

  6. #6
    5 Star Lounger
    Join Date
    Aug 2004
    Location
    Connecticut, USA
    Posts
    816
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You could use the Mid, Left, or Right functions depending upon your requirements. What portion of the cell do you want to use?

Posting Permissions

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