+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 17

Thread: How to copy and paste from one worksheet to another.

  1. #1
    Registered User
    Join Date
    11-15-2011
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    16

    How to copy and paste from one worksheet to another.

    Hello All,

    I want to copy/paste 2 pictures from other sheets in my workbook to the active sheet that I run the macro in.

    How do I do this?

    Currently it only works in 'sheet 3' but I want it to work for any worksheet that I execute the macro in.

    Sub Logos()
    '
    ' Macro5 Macro
    '
    
    '
    Sheets("Sheet1").Select
    ActiveSheet.Shapes.Range(Array("Picture 1")).Select
    Selection.Copy
    Sheets("Sheet3").Select
    Range("D2").Select
    ActiveSheet.Paste
    Sheets("Sheet2").Select
    ActiveSheet.Shapes.Range(Array("Picture 1")).Select
    Selection.Copy
    Sheets("Sheet3").Select
    Range("L2").Select
    ActiveSheet.Paste
    End Sub
    
    I found this code through searching but not sure how to implement it...
    
    Sub test()
    Dim wsF As Worksheet
    Dim wsU As Worksheet
    
    Set wsU = ThisWorkbook.Worksheets("Update")
    Set wsF = ThisWorkbook.Worksheets("Sheet2")
    
    
    wsF.UsedRange.Offset(1).Copy Destination:=wsU.Range("C5")
    End Sub
    Any help would be appreciated
    Last edited by pike; 11-15-2011 at 03:18 AM. Reason: add code tags for newbie pm rules

  2. #2
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    703

    Re: How to copy and paste from one worksheet to another.

    Sub steffen 
    
    Dim ws as worksheet
    Set ws = ActiveSheet
    
    With sheets(1)
         .Shapes.Range(Array("Picture 1")).Copy
    End with
    
         ws.Paste
               
    With sheets(2)
         .Shapes.Range(Array("Picture 1")).Copy
    End with
    
         ws.Paste
    
    End sub

  3. #3
    Registered User
    Join Date
    11-15-2011
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: How to copy and paste from one worksheet to another.

    Thanks man,

    Will give this a try. Im a bit confused how I set the range in the destination sheet?

    Range("L2").Select
    ws.Paste

  4. #4
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    703

    Re: How to copy and paste from one worksheet to another.

    Like this

    
    ws.Range("L2").Paste

  5. #5
    Registered User
    Join Date
    11-15-2011
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: How to copy and paste from one worksheet to another.

    Many thanks Steffen

  6. #6
    Registered User
    Join Date
    11-15-2011
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: How to copy and paste from one worksheet to another.

    It does'nt like the code. I tried to modify it but it select "B19" in active sheet and doesnt paste?

    Sub Logos()
    '
    ' Macro5 Macro
    '

    '

    Dim ws As Worksheet
    Set ws = ActiveSheet

    With Sheets(1)
    .Shapes.Range(Array("Logo1")).Select
    Selection.Copy
    End With

    ws.Range("D2").Paste

    End Sub

  7. #7
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    703

    Re: How to copy and paste from one worksheet to another.

    Why are you selecting, have you tried the code i gave you as it is?

    Dim ws as worksheet
    Set ws = ActiveSheet
    
    With sheets(1)
         .Shapes.Range(Array("Picture 1")).Copy
    End with
    
         ws.Range("L2").Paste
               
    With sheets(2)
         .Shapes.Range(Array("Picture 1")).Copy
    End with
    
         ws.Range("D2").Paste
    
    End sub
    Please take time to read the forum rules

  8. #8
    Registered User
    Join Date
    11-15-2011
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: How to copy and paste from one worksheet to another.

    I tried this also as it works for text..

    Sheets("Sheet1").Shapes.Range(Array("Logo2")).Copy Destination:=ActiveSheet.Range("D2").Paste

  9. #9
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    703

    Re: How to copy and paste from one worksheet to another.

    Can you upload the workbook? Or a workbook with similar data and i'll i have a look!
    Please take time to read the forum rules

  10. #10
    Registered User
    Join Date
    11-15-2011
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: How to copy and paste from one worksheet to another.

    It doesnt like this line..

    .Shapes.Range(Array("Picture 1")).Copy

    Error 438: Object doesnt support this property or method

  11. #11
    Registered User
    Join Date
    11-15-2011
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: How to copy and paste from one worksheet to another.

    One moment

  12. #12
    Registered User
    Join Date
    11-15-2011
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: How to copy and paste from one worksheet to another.

    Its Logos macro
    Last edited by rtcwlomax; 11-22-2011 at 02:56 PM.

  13. #13
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    703

    Re: How to copy and paste from one worksheet to another.

    Please upload to this site, there is an upload button when you post!
    Please take time to read the forum rules

  14. #14
    Registered User
    Join Date
    11-15-2011
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: How to copy and paste from one worksheet to another.

    Ok hopefully it attached.

    Thanks for your help
    Attached Files Attached Files

  15. #15
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    703

    Re: How to copy and paste from one worksheet to another.

    This works!
    Sub Steffen()
    Dim ws As Worksheet
    Set ws = ActiveSheet
    With Sheets(1)
         .Shapes("Picture 1").Copy
    End With
         ws.Range("L2").PasteSpecial    
    With Sheets(1)
         .Shapes("Logo2").Copy
    End With   
         ws.Range("L8").PasteSpecial
    End Sub
    Just change the destiantion range to fit
    Please take time to read the forum rules

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