Results 1 to 4 of 4
  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PasteSpecial Compile Error (03; SP1)

    I am receiving a compile error on the following code and I do not know why.

    Sheets("Sheet1").Range("C2:C17").Copy _
    Destination:=Workbooks(oWB).Sheets("Allocations"). Range("A2").PasteSpecial Paste:=xlPasteValues

    The compile error relates to "Paste" and is stated as "Expected: end of statement".

    If I take away the "PasteSpecial Paste:=xlPasteValues" the destination range is populated with formulas that are in Sheets("Alloc_Variances").Range("C2:C17"). The destination should have values not formulas.

    Thanks for your assistance,
    John

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: PasteSpecial Compile Error (03; SP1)

    You can't copy AND paste AND paste special in one go. You'll have to use two statements:

    Sheets("Sheet1").Range("C2:C17").Copy
    Workbooks(oWB).Sheets("Allocations").Range("A2").P asteSpecial Paste:=xlPasteValues

    Note that there is no line continuation character _ at the end of the first line.

  3. #3
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PasteSpecial Compile Error (03; SP1)

    Hans,

    I got hung up with MSoft's "help" feature which provide an example of "destination" for copy/paste.

    Thanks,
    John

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: PasteSpecial Compile Error (03; SP1)

    That example is for pasting only, not for paste special.

Posting Permissions

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