+ Reply to Thread
Results 1 to 10 of 10

Simple Copy Paste Macro

Hybrid View

NavSingh Simple Copy Paste Macro 06-21-2007, 12:54 AM
royUK I would create a template for... 06-21-2007, 03:46 AM
NavSingh Its for work, so i need to... 06-21-2007, 06:39 PM
NavSingh anyone? ? ? 06-21-2007, 11:38 PM
royUK Are you copying values or... 06-22-2007, 02:26 AM
  1. #1
    Registered User
    Join Date
    06-17-2007
    Posts
    8

    Simple Copy Paste Macro

    I have a really large excel file (90 Megs) And i want to copy the values and formats of certain sheets to another workbook. Ive tried using a copy/paste macro i had from work but the sheets have alot of groups and info so it kept freezing

    Can anyone help me?

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I would create a template for ease -see this

    failing that why not simply use the copy the whole sheet?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    06-17-2007
    Posts
    8
    Its for work, so i need to run this every week and one copy paste macro would help. The other one we used to use doesnt work, i dont know why but if anyone can just paste some code that would copy specific worksheets' values and formats into a new book

  4. #4
    Registered User
    Join Date
    06-17-2007
    Posts
    8
    anyone? ? ?

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Are you copying values or formulas? Which sheets need copying.

    You could either save the existing workbook as a new name & delete any unnecessary sheets or as I said copy specific sheets to a new workbook.

    For example

    Option Explicit
    
    Sub makeNew()
        Dim sNewName As String
        'get a new name for workboo, tis could be generated from the date perhaps
        sNewName = "newbook"
        'save existing workbook as the new name
        ThisWorkbook.SaveAs Filename:=ThisWorkbook.Path & sNewName & ".xls", FileFormat:= _
                            xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
                                                                                               , CreateBackup:=False
        'prevent warning message when deleting sheets
        Application.DisplayAlerts = False
        'remove unwanted sheets
        ActiveWorkbook.Sheets(Array("Sheet1", "Sheet2")).Delete
        Application.DisplayAlerts = True
    
    End Sub
    Last edited by royUK; 06-22-2007 at 02:37 AM.

  6. #6
    Registered User
    Join Date
    06-17-2007
    Posts
    8
    I still have this problem, I need to copy like 10 sheets To a new workbook. I don't want to save the work sheet because that will take too much time. I just want to copy Values and formats to a new work book for specific sheets.

    ive tried this

    Sheets(Array("Sheet1", "Sheet2")).Select
    Sheets("Sheet1").Activate
    Sheets(Array("Sheet1", "Sheet2")).Copy
    application.CutCopyMode = False

    Sheets("Sheet1").Select
    Cells.Select
    selection.Copy
    range("D1").Activate
    selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    range("A1").Select
    application.CutCopyMode = False


    Dim SaveDate
    SaveDate = Date$

    ActiveWorkbook.SaveAs Filename:="D:Workbook " & SaveDate & ".xls" _
    , FileFormat:=xlNormal, password:="", WriteResPassword:="", _
    ReadOnlyRecommended:=False, CreateBackup:=False

    range("A17").Select

    The problem with this is, the computer I do it on is too slow, so it just freezes up because of the array at the top. how can i do each sheet at a time??

+ 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