Results 1 to 7 of 7

Copy Paste values between sheets - values incorrect

Threaded View

  1. #1
    Registered User
    Join Date
    10-12-2010
    Location
    EUSA
    MS-Off Ver
    Excel 2007
    Posts
    7

    Copy Paste values between sheets - values incorrect

    Sheets("Models").Select
        Range("C6").Select
        Selection.Copy
        Sheets("Bill").Select
        Range("A1").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Range("A5").Select
        Application.CutCopyMode = False
        Selection.QueryTable.Refresh BackgroundQuery:=False
        Range("H2").Select
        Selection.Copy
        Sheets("Cost Pricer").Select
        Range("C6").PasteSpecial xlPasteValuesAndNumberFormats
        Application.CutCopyMode = False
        
        Sheets("Models").Select
        Range("C7").Select
        Selection.Copy
        Sheets("Bill").Select
        Range("A1").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Range("A5").Select
        Application.CutCopyMode = False
        Selection.QueryTable.Refresh BackgroundQuery:=False
        Range("H2").Select
        Selection.Copy
        Sheets("Cost Pricer").Select
        Range("C7").PasteSpecial xlPasteValuesAndNumberFormats
        Application.CutCopyMode = False

    All sheets located in the same workbook.
    I am copying a model number (Sheet "Models") into a bill of material spreadsheet (Sheet "Bill"), refreshing and taking the cost of the model (H2 cell) and copying it to another spreadsheet (Sheet "Cost Pricer") to develop a price list.

    The above formula plugs product model costs into two cells... C6 and C7.

    When I run the macro with only one cell (i.e. half the macro or eliminating the macro to plug a value into C7) everything works out fine. If I run the macro for additional cells (i.e. C7 or C8 or C9 or C10 etc)...the last cell will copy the correct values...but previous cells the values are incorrect and I am uncertain as to why this is happening...example:

    SHOULD BE:
    C6 $57.77
    C7 $58.99

    With one cell macro only I get
    C6 $57.77 (CORRECT VALUE)

    With more than one cell I get
    C6 $52.88 (WRONG VALUE)
    C7 $58.99 (CORRECT VALUE)

    Why does the addition of another cell to the macro cause inaccurate values in all cells except the very last cell in the macro?

    Thank you in advance
    Last edited by Leith Ross; 10-12-2010 at 12:45 PM. Reason: Added Code Tags

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