+ Reply to Thread
Results 1 to 2 of 2

Copy / Paste Values Only one sheet into another file from a multi sheet excel file

  1. #1
    Registered User
    Join Date
    06-27-2013
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    1

    Copy / Paste Values Only one sheet into another file from a multi sheet excel file

    Hello,

    I am a novice to Excel macro programming. I need to Copy one entire sheet and paste values and formats only in place and Save as a different excel file. The sheet has formulas referring to other sheets in the same work book.

    I searched this forum and tried the following code...but getting error "PasteSpecial method of Range class Failed"

    Dim objXLApp, objXLWb, objXLWs

    Set objXLApp = CreateObject("Excel.Application")

    objXLApp.Visible = True

    Set objXLWb = objXLApp.Workbooks.Open("path\Excel file name")
    Set objXLWs = objXLWb.Sheets("Summary")

    objXLWb.Sheets("sheet name").Activate

    objXLWb.Sheets("sheet name").Select
    objXLWb.ActiveSheet.Copy
    With objXLWb.ActiveSheet.UsedRange
    .Copy
    .PasteSpecial xlValues
    .PasteSpecial xlFormats
    End With
    Application.CutCopyMode = False


    Please advise, Thanks a lot in advance.

  2. #2
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: Copy / Paste Values Only one sheet into another file from a multi sheet excel file

    It works fine for me..
    Regards!
    =DEC2HEX(3563)

    If you like someone's answer, click the star to give them a reputation point for that answer...

+ 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