+ Reply to Thread
Results 1 to 7 of 7

How does copy value only syntax works?

  1. #1
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    How does copy value only syntax works?

    I do not know what I am doing wrong. The following line shows no error

    Please Login or Register  to view this content.

    But if I just want to copy values only, it gives me a syntax error. Is it because, you can not put PasteSpecial xlPasteValues in one line?

    I have also recorded a marco to test it and shows the same syntax for copy only.

    Please Login or Register  to view this content.
    Please help me.

  2. #2
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: How does copy value only syntax works?

    Hi,
    The first line of code gives no error because Range.Copy method takes the target range as an optional argument, but you cannot paste special in this case.
    Just put the target range on a new line to be able to do paste special:

    Please Login or Register  to view this content.
    If you are pleased with a member's answer then use the Star icon to rate it.

  3. #3
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: How does copy value only syntax works?

    or
    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How does copy value only syntax works?

    Buran! Great! Thanks for explanation.
    I suspected it was something to do with a new line, but could not figure it out.

  5. #5
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: How does copy value only syntax works?

    note that the code suggested by nilem is better as it does not use Clipboard

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How does copy value only syntax works?

    Nilem and Buran! Thank you very much again!

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How does copy value only syntax works?

    Nilem,
    I have not seen this line before. Is it the same as the offset function?

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1