+ Reply to Thread
Results 1 to 6 of 6

VBA code to copy worksheet and paste as values

  1. #1
    Registered User
    Join Date
    02-05-2016
    Location
    Lille
    MS-Off Ver
    2010
    Posts
    3

    Question VBA code to copy worksheet and paste as values

    I need a macro that selects a specific worksheet, copy, then paste as values to a new worksheet.

    So when I click on the button of my macro, it would copy the daton from my "Trame" worksheet, and then, create a new worksheet with only the values and the format. This way, if I delete or change the data in the "Trame" sheet, my new sheet won't change anyhow.

    Any help would be appreciated.

    Vince

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by TheTrueVince; 02-05-2016 at 09:02 AM.

  2. #2
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,192

    Re: VBA code to copy worksheet and paste as values

    you don't need all these error codes

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    02-05-2016
    Location
    Lille
    MS-Off Ver
    2010
    Posts
    3

    Re: VBA code to copy worksheet and paste as values

    Hi Ranman and thank you for your answer.

    I tried your help but it says "sName" is not define. And I don't see how it can copy only the value and not the formulas. Should't we have to use "PasteSpacial Value" ?

    Please Login or Register  to view this content.

  4. #4
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,788

    Re: VBA code to copy worksheet and paste as values

    Try adding a Dim statement for sName i.e.
    Please Login or Register  to view this content.
    To convert formulas to value try adding this line to macro

    Please Login or Register  to view this content.
    Alf

  5. #5
    Registered User
    Join Date
    02-05-2016
    Location
    Lille
    MS-Off Ver
    2010
    Posts
    3

    Re: VBA code to copy worksheet and paste as values

    Thank you so much, everything works !!

  6. #6
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,788

    Re: VBA code to copy worksheet and paste as values

    You are welcome.

    Thanks for feedback and rep

    Alf

+ 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. [SOLVED] VBA code for copy and paste values
    By adriano.r.marques in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-30-2015, 01:23 PM
  2. [SOLVED] Copy/Paste Values Using VBA Code
    By DanielGordo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-19-2014, 09:51 AM
  3. Replies: 0
    Last Post: 01-29-2014, 07:38 AM
  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. [SOLVED] Need Help w/ Code for Copy/Paste data for a Summary Worksheet
    By Langie in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-26-2013, 05:21 PM
  6. [SOLVED] Automatically copy and paste (or update) cell values to another worksheet using VBA code
    By jjin in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-21-2013, 04:56 AM
  7. Need VBA Code to copy paste rows from worksheet to another
    By amasulli in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-11-2012, 02:16 PM

Tags for this Thread

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