+ Reply to Thread
Results 1 to 4 of 4

VBA to Paste Values not Formulas.

Hybrid View

  1. #1
    Registered User
    Join Date
    10-26-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    13

    VBA to Paste Values not Formulas.

    Hi, I currently have this formula

    Private Sub CommandButton2_Click()
    Dim ws1 As Worksheet, ws2 As Worksheet
    Dim DestRow As Long
    Set ws1 = Sheets("Month Template")
    Set ws2 = Sheets("Development Plan Log")
    DestRow = ws2.Cells(Rows.Count, "A").End(xlUp).Row + 1
    ws1.Range("x3").Copy ws2.Range("A" & DestRow)
    ws1.Range("p27").Copy ws2.Range("B" & DestRow)
    End Sub

    However it pastes the formulas and I just want it to paste the values. Can you please advise how I would achieve this?

    Thanks
    Hayley

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

    Re: VBA to Paste Values not Formulas.

    ws1.Range("x3").Copy 
    ws2.Range("A" & DestRow).PasteSpecial xlValues
    or
    ws2.Range("A" & DestRow).Value = ws1.Range("x3").Value
    Change the other line in your code the same way.

  3. #3
    Registered User
    Join Date
    10-26-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: VBA to Paste Values not Formulas.

    Your 2nd option worked perfectly! Thank you so much!!!

  4. #4
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: VBA to Paste Values not Formulas.

    Hayley

    I'm not on computer at the moment (on the iPad) but I think this should get you the values only

    
    Private Sub CommandButton2_Click()
        Dim ws1 As Worksheet, ws2 As Worksheet
        Dim DestRow As Long
        Set ws1 = Sheets("Month Template")
        Set ws2 = Sheets("Development Plan Log")
        DestRow = ws2.Cells(Rows.Count, "A").End(xlUp).Row + 1
        ws1.Range("x3").Copy ws2.Range("A" & DestRow).PasteSpecial xlPasteValues
        ws1.Range("p27").Copy ws2.Range("B" & DestRow).PasteSpecial xlPasteValues
    End Sub
    Happy with my advice? Click on the * reputation button below

+ 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. copy paste values for formulas
    By ammartino44 in forum Excel General
    Replies: 3
    Last Post: 05-07-2015, 10:03 PM
  2. Copy Formulas and Paste into the Last Set # of Rows Only & Paste Values
    By Mr. Ice in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-23-2014, 07:48 AM
  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. paste values only not formulas
    By tjjersey in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-22-2013, 01:12 PM
  5. [SOLVED] Macro to paste formulas then paste values
    By deanstein in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-19-2013, 11:30 AM
  6. Paste VALUES...not FORMULAS
    By HuskerBronco in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-30-2007, 01:20 PM
  7. [SOLVED] How can I paste formulas only an not values
    By RAD in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-12-2005, 10:05 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