+ Reply to Thread
Results 1 to 7 of 7

Copy entire row - but values not formula

  1. #1
    Registered User
    Join Date
    08-16-2012
    Location
    Auckland New Zealand
    MS-Off Ver
    Excel 2003
    Posts
    15

    Copy entire row - but values not formula

    I have the code below which copies input from a sales input form into the sales worksheet. The sales input form uses vlookup to return value such as category, item name and price from and inventory worksheet.

    Problem is if I then later change the price of an item it cahnges the "Sales" history. as it is the formula that is pasted and not the values. I am thinking that if only the value is pasted to the "Sales" history worksheet then any changes to inventory will not affect the history. I have tried playing with the code but keep getting errors.

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor rollis13's Avatar
    Join Date
    01-26-2012
    Location
    Cordenons
    MS-Off Ver
    Excel 2016 32bit - Win 11
    Posts
    935

    Re: Copy entire row - but values not formula

    Splitting the row and adding a PasteSpecial should do the trick.
    From:
    Please Login or Register  to view this content.
    To:
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    08-09-2012
    Location
    Anch, Alaska
    MS-Off Ver
    2003, 2010, 2013
    Posts
    131

    Re: Copy entire row - but values not formula

    An additional Enumeration to rollis13 post.
    If you have Special Formatting on those Cells you can also use xlPasteValuesAndNumberFormats to preserve the formatting.

    xlPasteValuesAndNumberFormats
    vs.
    xlPasteValues

  4. #4
    Registered User
    Join Date
    08-16-2012
    Location
    Auckland New Zealand
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Copy entire row - but values not formula

    Thankyou
    I was trying to put the PasteSpecial at the beginning rather than the end. I have no idea how you guys know all this stuff - 3 weeks ago I had never used a macro now I have (wth help from this forum) created a mini program with reasonable reporting and functionality - just file a little big at the moment working on that one.. I am astounded what excel can actually do. But I am learning quickly. One other question have I duplicated code in the above? seems like I have repeated my If statement?

    Also i understand I am meant to go back to my orginal post and post and edit to post solved - but I am being a little dim and cannot manage to do it. Can someone explain to a real idiot how to actually do this please.
    Thanks
    Kazza

  5. #5
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,110

    Re: Copy entire row - but values not formula

    It's like using Chinese for 3 months and be amazed how people in China know all those letters


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:
    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save
    Never use Merged Cells in Excel

  6. #6
    Valued Forum Contributor rollis13's Avatar
    Join Date
    01-26-2012
    Location
    Cordenons
    MS-Off Ver
    Excel 2016 32bit - Win 11
    Posts
    935

    Re: Copy entire row - but values not formula

    Quote Originally Posted by nzkazza View Post
    One other question have I duplicated code in the above? seems like I have repeated my If statement?
    Yes, (I think) your code does duplicate more than necessary. You should attach a file with a small sample of your data to allow other to understand what's going on. Showing how it is before and then after would be usefull.

  7. #7
    Registered User
    Join Date
    08-16-2012
    Location
    Auckland New Zealand
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Copy entire row - but values not formula

    Changed the code to the below and thought it was working great but I have now discovered that it is only copying the last row to the destination sheet not all populated rows as it was before> Any ideas?

    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