+ Reply to Thread
Results 1 to 3 of 3

copy and paste

  1. #1
    Valued Forum Contributor Blake 7's Avatar
    Join Date
    10-01-2010
    Location
    Bogota, Colombia
    MS-Off Ver
    Excel 2010 64 bit and Excel 2007,
    Posts
    1,377

    copy and paste

    Hi Guys, hope all is well.

    As you will see from the code below I am trying to copy the contents of a worksheet to a new sheet.

    However, I am having trouble getting the pictures to copy over. I have attached a dummy sample. Press Ctrl Q to run the macro.
    It works fine without the line "Worksheets("Winback Current Report").objpic.Copy" but i really need the images.

    Any ideas please?


    HTML Code: 
    Attached Files Attached Files
    Blake 7

    If your question has been answered, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

    If any member's response has helped to solve your problem, please consider using the scales icon on the top right of their post to show your appreciation.

    http://failblog.org/

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: copy and paste

    Blake 7
    You have two copies in consecutives
    You are copying cells and without pasting and you copying another one
    Please Login or Register  to view this content.
    Last edited by AB33; 11-26-2012 at 01:28 PM.

  3. #3
    Valued Forum Contributor Blake 7's Avatar
    Join Date
    10-01-2010
    Location
    Bogota, Colombia
    MS-Off Ver
    Excel 2010 64 bit and Excel 2007,
    Posts
    1,377

    Re: copy and paste

    Hiya,

    Thanks, in the end I got it to work like this. Im not sure that its brilliant coding but it seems to work.

    If anyone can see a smarter way please share.

    Sub NewSheetFromTemplate()
    Dim sName As String

    sName = Application.InputBox("Enter the new sheet name:", Title:="New Sheet Title", Type:=2)
    If sName = "" Then Exit Sub
    Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = sName

    Worksheets("Winback Current Report").Cells.Copy
    Worksheets(sName).Range("A1").PasteSpecial (xlPasteValues)
    Worksheets(sName).Range("A1").PasteSpecial (xlPasteFormats)
    Worksheets("Winback Current Report").Shapes("Pic1").Copy
    Worksheets(sName).Range("A1").PasteSpecial
    Worksheets("Winback Current Report").Shapes("Pic2").Copy
    Worksheets(sName).Range("I1").PasteSpecial


    End Sub

+ 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