+ Reply to Thread
Results 1 to 18 of 18

Modify code to transfer cell value and formats

  1. #1
    Forum Contributor
    Join Date
    06-28-2018
    Location
    New York
    MS-Off Ver
    MS Office 2010
    Posts
    184

    Modify code to transfer cell value and formats

    Hi All,

    I am using the below to transfer data between 2 workbooks. Is there a way (perhaps by modifying the .Value) to also transfer the source formatting as well? Any assistance would be greatly appreciated. Thank you.


    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,719

    Re: Modify code to transfer cell value and formats

    Just a regular Copy/Paste should do that
    Please Login or Register  to view this content.
    or any variation of the above

  3. #3
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,888

    Re: Modify code to transfer cell value and formats

    Maybe
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    06-28-2018
    Location
    New York
    MS-Off Ver
    MS Office 2010
    Posts
    184

    Re: Modify code to transfer cell value and formats

    Thank you both.

    jolivanes - how do i modify yours to work with the src and dest

    Fluff13 - I am getting a 424 error on the pasteformats line

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,888

    Re: Modify code to transfer cell value and formats

    What is the error message?

  6. #6
    Forum Contributor
    Join Date
    06-28-2018
    Location
    New York
    MS-Off Ver
    MS Office 2010
    Posts
    184

    Re: Modify code to transfer cell value and formats

    Run-time error '424' Object required

  7. #7
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,888

    Re: Modify code to transfer cell value and formats

    In that case check that dest has been declared & set properly.

  8. #8
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,719

    Re: Modify code to transfer cell value and formats

    Re: how do i modify yours to work with the src and dest
    Show the whole code please

  9. #9
    Forum Contributor
    Join Date
    06-28-2018
    Location
    New York
    MS-Off Ver
    MS Office 2010
    Posts
    184

    Re: Modify code to transfer cell value and formats

    Fluff13 - It looks like dest has been declared and set - see below.

    Please Login or Register  to view this content.
    jolivanes - does my intial/original post provide the necessary info?

  10. #10
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,888

    Re: Modify code to transfer cell value and formats

    That looks fine, in which case I cannot see why you are getting an "Object required" error.
    Can you post your entire code?

  11. #11
    Forum Contributor
    Join Date
    06-28-2018
    Location
    New York
    MS-Off Ver
    MS Office 2010
    Posts
    184

    Re: Modify code to transfer cell value and formats

    Please Login or Register  to view this content.

  12. #12
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,888

    Re: Modify code to transfer cell value and formats

    Ok, this
    Please Login or Register  to view this content.
    should be on two lines as per post#3

  13. #13
    Forum Contributor
    Join Date
    06-28-2018
    Location
    New York
    MS-Off Ver
    MS Office 2010
    Posts
    184

    Re: Modify code to transfer cell value and formats

    Got it. Ok that fixed the '424' error.

    I am now getting a run-time error '1004' PasteSpecial method of Range class failed on the pastevalues line

  14. #14
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,888

    Re: Modify code to transfer cell value and formats

    If you step through the code using F8, once it has pasted the formats, does it go straight to the next line, or does it take you to some other code first?

  15. #15
    Forum Contributor
    Join Date
    06-28-2018
    Location
    New York
    MS-Off Ver
    MS Office 2010
    Posts
    184

    Re: Modify code to transfer cell value and formats

    When I step through that error pops up right after I pass the paste formats.

  16. #16
    Forum Contributor
    Join Date
    06-28-2018
    Location
    New York
    MS-Off Ver
    MS Office 2010
    Posts
    184

    Re: Modify code to transfer cell value and formats

    I think merged cells might be causing the problem. The source is a system generated report. At the top of the report (above the headers) there is a merged section that shows up after the paste formats.

  17. #17
    Forum Contributor
    Join Date
    06-28-2018
    Location
    New York
    MS-Off Ver
    MS Office 2010
    Posts
    184

    Re: Modify code to transfer cell value and formats

    I modified the system report and it was the merged section causing the error. Your code works great Fluff13. Thank you, I appreciate the help!

  18. #18
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,888

    Re: Modify code to transfer cell value and formats

    Glad you sorted it & thanks for the feedback

+ 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. Replies: 1
    Last Post: 05-08-2018, 02:41 AM
  2. [SOLVED] Modify starting cell in code
    By BDD2015 in forum Excel General
    Replies: 2
    Last Post: 10-25-2017, 05:52 AM
  3. Need help to modify VBA code Drop down transfer lists
    By ElmerFud in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-17-2015, 04:51 PM
  4. Transfer Data from one sheet to another and formats
    By city in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-15-2014, 07:13 PM
  5. Modify Code to Log Cell Input and Value
    By HP RodNuclear in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-12-2011, 10:13 AM
  6. Help on how to apply and modify cell formats?
    By fatmermaid in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-04-2011, 12:49 PM
  7. How do I modify my VBA cell splitter code?
    By stormracela in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-07-2010, 12:30 AM

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