ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing Picture Number when cutting and pasting (https://www.excelbanter.com/excel-programming/399058-changing-picture-number-when-cutting-pasting.html)

[email protected]

Changing Picture Number when cutting and pasting
 
I am using a macro to copy and paste an image from one workbook to
another. When I copy the image from Workbook A it is "Picture 1".
When I paste it into Workbook B is becomes the next image in
progression for example "Picture 1863" I need to have the macro
automatically recognize the new "Picture Number" so that I can utilize
positioning commands such as:

Sheet1.Shapes("Picture 1").Left = Range("H29").Center
Sheet1.Shapes("Picture 1").Top = Range("H29").Top

What can be utilized to to allow the new "Picture Number" to be
utilized in the positioning commands?

I might also point out this image copies and pastes in to 6 different
worksheets on the same workbook so each time the image pastes, it
takes on a new number. I need to be able to control the positioning
of each image.


JE McGimpsey

Changing Picture Number when cutting and pasting
 
Use the technique I used in my reply to your other post, e.g.:

With Sheet1
With .Pictures(.Pictures.Count)
.Left = .Range("H29").Left
.Top = .Range("H29").Top
End With
End With

No need to know the name of the picture at all...

In article om,
wrote:

I am using a macro to copy and paste an image from one workbook to
another. When I copy the image from Workbook A it is "Picture 1".
When I paste it into Workbook B is becomes the next image in
progression for example "Picture 1863" I need to have the macro
automatically recognize the new "Picture Number" so that I can utilize
positioning commands such as:

Sheet1.Shapes("Picture 1").Left = Range("H29").Center
Sheet1.Shapes("Picture 1").Top = Range("H29").Top

What can be utilized to to allow the new "Picture Number" to be
utilized in the positioning commands?

I might also point out this image copies and pastes in to 6 different
worksheets on the same workbook so each time the image pastes, it
takes on a new number. I need to be able to control the positioning
of each image.



All times are GMT +1. The time now is 03:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com