Reputation: 181
i have below vba codes copy existing worksheet data to new worksheet, it's working fine, but it won't copy pictures file (eg.jpg) in worksheet, how can i copy picture file as well? Thank you.
Set source2 = Worksheets("today").Range("A5:l68")
Sheets.Add After:=Sheets(Sheets.Count)
Set dest2 = ActiveWorkbook
Source2.Copy
With dest2.Sheets(2)
.Cells(1).PasteSpecial Paste:=8
.Cells(1).PasteSpecial Paste:=xlPasteValues
.Cells(1).PasteSpecial Paste:=xlPasteFormats
.Cells(1).Select
Application.CutCopyMode = False
End With
Upvotes: 3
Views: 22525
Reputation: 263
I think this question is a duplicate of copy & paste a picture from one sheet to another , regardless you can use the code below...This should paste Pictures to new sht in approx same position as original sheet.
Sub MG15Jun43
Dim pic As Shape, rng As Range
For Each pic In ActiveSheet.Shapes
If pic.Type = msoPicture Then
pic.Copy
With Sheets("Sheet2")
.Select
.Range(pic.TopLeftCell.Address).Select
.Paste
End With
Selection.Placement = xlMoveAndSize
End If
Next pic
End Sub
Upvotes: 4