+ Reply to Thread
Results 1 to 14 of 14

Using code to paste values

  1. #1
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Using code to paste values

    Hi.
    When the code tries pasting something i get this error message: "paste special method of range class failed".

    Here's my code, see the red font....
    Please Login or Register  to view this content.
    Last edited by kosherboy; 06-12-2014 at 09:58 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Using code to paste values

    Never mind... i forgot to copy a value

  3. #3
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Using code to paste values

    Is something copied?
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  4. #4
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Using code to paste values

    That was the part that i forgot to put in the code.
    This is how it should have looked:
    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Using code to paste values

    Range("F" & rCell).value =Range("K" & rCell).value

    would be better than your code then, no need for cutting and pasting.

  6. #6
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Using code to paste values

    True, but i am actually just posting an example of the real code that i had issues with (and i still have issues with). That code is copying a cell from a different workbook and pasting it into the "rCell".
    Can i post it for you to look at?

  7. #7
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Using code to paste values

    See red font with the issue.
    Enjoy
    Please Login or Register  to view this content.

  8. #8
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Using code to paste values

    If the workbooks are open you can do the same

    open your work book into a variable

    ActiveSheet.Copy
    set wbNew = activeworkbook

    then range("S" & rcell).value = wbNew.range("H16")

    i think , i am not in excel at the minute

  9. #9
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Using code to paste values

    I hear but that workbook gets closed by the code. And it's imperative that the workbook gets closed.

    Please Login or Register  to view this content.

  10. #10
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Using code to paste values

    You're closing the activewindow not the activeworkbook.

  11. #11
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Using code to paste values

    What should the difference be then?

  12. #12
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Using code to paste values

    What can i do to fix the issue?

  13. #13
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Using code to paste values

    Activeworkbook.close savechanges:=true/false

  14. #14
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Using code to paste values

    It's still not working
    I don't mind waiting...

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Code to paste values not formulas
    By excellearner121 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-22-2014, 06:33 AM
  2. Help with a VBA code to paste only values from a Web Query
    By adtamez in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-06-2014, 02:16 PM
  3. [SOLVED] Changing Current Code from Paste Formulas to Paste Values
    By freybe06 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-24-2013, 12:33 PM
  4. Copy and paste code pasting won't paste just values
    By thehotbreadguy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-09-2013, 11:12 PM
  5. Changing code to paste as values
    By rhudgins in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-25-2010, 09:18 PM

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