Results 1 to 11 of 11

Macro to Copy Paste Values and Formulas

Threaded View

  1. #1
    Registered User
    Join Date
    10-08-2009
    Location
    Granite Falls, NC
    MS-Off Ver
    Excel 2003
    Posts
    17

    Macro to Copy Paste Values and Formulas

    I have an existing macro that copies a worksheet and pastes it into another workbook, renames it and then attaches it to an email. My problem is that it pastes just the values. I need it to paste part of the original worksheet as values and part copy the formulas. So on the new workbook Columns A through F will be values only and G through Z will copy the formulas. Here is the script that I am working with. Thanks for any help.

    Private Sub CommandButton2_Click()
    
        Range("A1").Select
        ActiveCell.SpecialCells(xlLastCell).Select
        Range(Selection, Cells(1)).Select
        Selection.Copy
        Workbooks.Add
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
            SkipBlanks:=False, Transpose:=False
        ActiveWorkbook.SaveAs Filename:= _
            "C:\flapricelist.xls", FileFormat:= _
            xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
            , CreateBackup:=False
        'Windows("flapricelist.xls").Activate
        'Cells.Select
        'Cells.EntireRow.AutoFit
        'Cells.EntireColumn.AutoFit
        'Cells.EntireRow.AutoFit
               
    Rem Application.CutCopyMode = False
    Rem Application.Dialogs(xlDialogSendMail).Show
    Rem ActiveWorkbook.Close Savechanges:=True
        
        
    End Sub
    Last edited by thillis; 10-19-2009 at 01:01 PM.

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