Consulting

Results 1 to 9 of 9

Thread: Solved: bypassing clipboard

  1. #1
    VBAX Tutor
    Joined
    Nov 2007
    Posts
    291
    Location

    Solved: bypassing clipboard

    I want to copy and paste values but bypass the clipboard. I do :

    Sheets("Sheet1").Range("a1:b10").Copy _
    Sheets("Sheet2").Range("a1").xlValues

    it doesnt like it

    What should I do instead

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Why do you need to bypass the clipboard?
    ____________________________________________
    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
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    Sheets("Sheet1").Range("a1:b10").Copy Destination:=Sheets("Sheet2").Range("a1")
    but you need to use paste special
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  4. #4
    VBAX Tutor
    Joined
    Nov 2007
    Posts
    291
    Location

    pastespecial

    I bypass the clipboard because in some instances I copy from another spreadsheet and it eliminates hassle.

    It is the pastespecial I am having trouble with so in the reply below :-

    Sheets("Sheet1").Range("a1:b10").Copy Destination:=Sheets("Sheet2").Range("a1")

    How would I adapt that for pastespecial values

  5. #5
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    record it in the macro recorder.....however you wil always use the clipboard if you copy something, if you reference it via formula you do not use the clipboard but if the values in the source book change then so will your destination book when both are open!
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  6. #6
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    [VBA]
    Sub Macro1()
    Range("A1:A10").copy
    With Sheets("Sheet2").Range("A1")
    .PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    End With
    End Sub

    [/VBA]
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  7. #7
    VBAX Regular HaHoBe's Avatar
    Joined
    Aug 2004
    Location
    Hamburg
    Posts
    89
    Location
    Hi, philfer,

    just copy values directly without using copy&paste:

    Sheets("Sheet2").Range("A1").Resize(10, 1).Value = _
        Sheets("Sheet1").Range("A1").Resize(10, 1).Value
    Ciao,
    Holger

  8. #8
    Administrator
    Chat VP
    VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    Quote Originally Posted by philfer
    I bypass the clipboard because in some instances I copy from another spreadsheet and it eliminates hassle.

    It is the pastespecial I am having trouble with so in the reply below :-

    Sheets("Sheet1").Range("a1:b10").Copy Destination:=Sheets("Sheet2").Range("a1")

    How would I adapt that for pastespecial values
    Simple answer is - you can't - bypassing the clipboard like that only works for a straight paste, not a pastespecial. If you only want the values, copy them directly without a paste as HaHoBe has shown.
    You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you

    The major part of getting the right answer lies in asking the right question...


    Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.

  9. #9
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    Sheets("Sheet2").Range("a1:b10").Value= Sheets("Sheet1").Range("a1:b10").Value

Posting Permissions

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