Copying Picture

superg

New Member
Joined
Jan 20, 2005
Messages
24
Hi all, I have inserted a picture into a worksheet and now what I want to do is to copy the picture and insert it into another worksheet in cells A1:C5 and then when I change the picture in the first sheet i want it to insert the new picture underneath the picture that was just inserted, so in the new sheet in cells A6:C10. Thanks.
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Ok Guys, I have got this far, this code enables me to insert a picture into the current sheet, then copys this pictures to a denstination in the Photos sheet.

Private Sub Label2_Click()

Dim myPicture As String

myPicture = Application.GetOpenFilename _
("Pictures (*.gif; *.jpg; *.bmp; *.tif),*.gif; *.jpg; *.bmp; *.tif", , "Select Picture to Import")
If myPicture <> "" Then
ActiveSheet.Range("E4").Select
ActiveSheet.Pictures.Insert (myPicture)
ActiveSheet.Shapes(ActiveSheet.Shapes.Count).Select


With Selection

'RowNumber = Worksheets("Photos").[a65536].End(xlUp).Offset()
.ShapeRange.LockAspectRatio = msoFalse
.ShapeRange.Height = ActiveCell.RowHeight * 6
.ShapeRange.Width = ActiveCell.ColumnWidth * 65
.Copy
Sheets("Photos").Select
ActiveSheet.Range("A3").Select
ActiveSheet.Paste
Selection.ShapeRange.ScaleWidth 0.72, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 0.61, msoFalse, msoScaleFromTopLeft

End With
End If
End Sub

If i delete the picture in the first sheet, and insert a new one it goes on op of the other picture in the Photos sheet, the new destination should be this code below

Selection.ShapeRange.IncrementTop 90#

How do I get it so each time i insert a new picture it moves it down this far each time?
 
Upvote 0
I believe this line of code is causing you grief. There may be others?
Code:
ActiveSheet.Range("A3").Select
You need to tell XL where to variably paste your picture. So try..
ActiveSheet.Range("A" & X).Select where "X" is 1,91,181 etc. So make "X" a variable and loop your code. Hope this works for you. Dave
 
Upvote 0
Thanks for your help, I still dont get how to do it, does anyone else have a solution?
 
Upvote 0
Here's some code to play around with. I'm sure that there is a more eloquent solution but this should get you started. Just add your chart sizing stuff. Dave
edit: forgot to post code
Code:
Private Sub CommandButton1_Click()
'selects picture file inserts to sheet1 A range
'then copies inserted picture to sheet2 E range
'loops x5 in this eg.
Dim myPicture As String, X As Integer
For X = 1 To 21 Step 5 'change to suit
myPicture = Application.GetOpenFilename _
("Pictures (*.gif; *.jpg; *.bmp; *.tif),*.gif; *.jpg; *.bmp; *.tif", , _
"Select Picture to Import")
If myPicture <> "" Then
Sheets("sheet1").Range("A" & X).Select
ActiveSheet.Pictures.Insert (myPicture)
ActiveSheet.Shapes(ActiveSheet.Shapes.Count).Select
With Selection
.Copy
Sheet2.Activate
Sheets("sheet2").Range("E" & X).Select
ActiveSheet.Paste
End With
End If
Sheet1.Activate
Next X
Application.CutCopyMode = False
End Sub
 
Upvote 0
Sorry to bug you again, this code is sort of working, but with this code once i have inserted the pic it asks to insert another one but i dont want this i want to be able to clear the first pic then once i click the button again i can insert the next pic, thanks.
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,742
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top