+ Reply to Thread
Results 1 to 4 of 4

need correction in code

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-21-2010
    Location
    Budapest
    MS-Off Ver
    Excel 2010
    Posts
    155

    need correction in code

    I have a macro created by someone which I should modify to copy the VALUE not the formula.
    Please help me to modify the line to copy and paste only the VALUE.

    Code.Offset(0, 6).Copy wsR.Range("F" & NR, "F" & BR)
    
    If LR > 1 Then
                    wsD.Range("A2:E" & LR).Copy wsR.Range("A" & NR)
                    BR = wsR.Range("E" & wsR.Rows.Count).End(xlUp).Row
                    Code.Offset(0, 6).Copy wsR.Range("F" & NR, "F" & BR)
                    NR = BR + 1
    End If
    Last edited by ccsmith; 05-04-2012 at 06:14 AM.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: need correction in code

    Change it to
    Code.Offset(0, 6).Copy
    wsR.Range("F" & NR, "F" & BR).pastespecial paste:=xlvalues
    And

    If LR > 1 Then
                    wsD.Range("A2:E" & LR).Copy
                    wsR.Range("A" & NR).pastespecial paste:=xlvalues
                    BR = wsR.Range("E" & wsR.Rows.Count).End(xlUp).Row
                    Code.Offset(0, 6).Copy
                    wsR.Range("F" & NR, "F" & BR).pastespecial paste:=xlvalues
                    NR = BR + 1
    End If
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Forum Contributor
    Join Date
    04-21-2010
    Location
    Budapest
    MS-Off Ver
    Excel 2010
    Posts
    155

    Re: need correction in code

    Thanks for everybody.
    I will use arlu1201 's solution.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,488

    Re: need correction in code

    Consider the difference between:

    Range("D1") = Range("C1").Value

    and:

    Range("E1") = Range("C1").Formula


    You should be able to adapt the first method.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ 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