+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    03-11-2010
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2003
    Posts
    8

    Copy Values not Formulas

    Hi,
    Is there any way to copy a cell to another sheet as a Value, not as a formula.

    I'm using this method of copy for I need to create a list of all the datas from many worksheet in one.
    Code:
    For J = 2 To Sheets.Count
        Sheets(J).Activate 
        Range("B23:B31").Select
        Selection.Copy Destination:=Sheets(1).Range("A65536").End(xlUp)(2)
    Next
    For B23 is a value and from B24 to B31, it' =(B23)
    Using the "Selection.Copy Destination" is there anything I could add to it so that it copies the value?

    I don't want to change all my macros, because I've got a couple with this kind of copy..

    Any help would be appreciated.
    Last edited by powpowninjastar; 03-18-2010 at 02:22 PM.

  2. #2
    Forum Moderator shg's Avatar
    Join Date
    06-21-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007
    Posts
    25,134

    Re: Copy Values not Formulas

    Code:
        For j = 2 To Worksheets.Count
            Worksheets(j).Range("B23:B31").Copy
            Worksheets(1).Cells(Rows.Count, "A").End(xlUp)(2).PasteSpecial Paste:=xlPasteValues
        Next j
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    03-11-2010
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Copy Values not Formulas

    Would this work if I have multiple range i have to copy? I might not have been clear enough.. here's my whole macro.

    Code:
    Dim J As Integer
    
        On Error Resume Next
    Application.DisplayAlerts = False
    Sheets("Résumé").Delete
        Count_Sheets = ThisWorkbook.Sheets.Count
        Sheets.Add Before:=Sheets(1), Type:="C:\Documents and Settings\admin\Application Data\Microsoft\Modèles\resume.xlt"
        Sheets(1).Name = "Résumé"
        ActiveSheet.Range("I1").Value = Count_Sheets
        ' work through sheets
        For J = 2 To Sheets.Count ' from sheet 2 to last sheet
        Sheets(J).Activate ' make the sheet active
        Range("B23:B31").Select
        Selection.Copy Destination:=Sheets(1).Range("A65536").End(xlUp)(2)
        'Marque
        Range("D23:D31").Select
        Selection.Copy Destination:=Sheets(1).Range("B65536").End(xlUp)(2)
        'Description Produit
        Range("E23:E31").Select
        Selection.Copy Destination:=Sheets(1).Range("C65536").End(xlUp)(2)
        'No Série
        Range("F23:F31").Select
        Selection.Copy Destination:=Sheets(1).Range("D65536").End(xlUp)(2)
        'Étiquette
        Range("G23:G31").Select
        Selection.Copy Destination:=Sheets(1).Range("E65536").End(xlUp)(2)
        'Succ
        Range("c1:c9").Select
        Selection.Copy Destination:=Sheets(1).Range("g65536").End(xlUp)(2)
        'Kit
        Range("f10:f18").Select
        Selection.Copy Destination:=Sheets(1).Range("h65536").End(xlUp)(2)
        Next
    End Sub
    From B to G, everything if fine, everything is typed manually, but C1:C9 and F10:F18 are formulas.

    So i'd like to copy the value not the formulas from these two. c1:c9 & f:10f:18
    Last edited by powpowninjastar; 03-17-2010 at 03:25 PM.

  4. #4
    Forum Moderator shg's Avatar
    Join Date
    06-21-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007
    Posts
    25,134

    Re: Copy Values not Formulas

    So, try it.
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Registered User
    Join Date
    03-11-2010
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Copy Values not Formulas

    yes it works thank you, it's just a little longer, it flips between the first page and the "J" page a lot since I have around 20 pages, but meh it'd be much longer to copy paste it myself thanks

  6. #6
    Forum Moderator shg's Avatar
    Join Date
    06-21-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007
    Posts
    25,134

    Re: Copy Values not Formulas

    In the example I posted, I eliminated the Selects. If you applied that throughout, you woudn't see any 'flipping'
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

  7. #7
    Registered User
    Join Date
    03-11-2010
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Copy Values not Formulas

    I can't try it now, logicaly it should work, I tried it in a hurry so I might have made a few mistakes. I'll try it tomorrow. Thanks

  8. #8
    Registered User
    Join Date
    03-11-2010
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Copy Values not Formulas

    Tried it, works perfectly well tyhank you

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.2.0