0

Continuing the operation raised in this issue:

Copying image between the sheets with instant resizing & adjusting

Now I would like to set an automatic on-click delete option for these newly copied images.

enter image description here

I have written the simple macro for this purpose:

  Sub Signature_remove()
  '
  ' Signature_remove Macro
  '


   ActiveSheet.Shapes.Range(Array("Picture 49")).Select
   Selection.Delete
   Sheets("BoQ Civils").Select
   ActiveSheet.Shapes.Range(Array("Picture 72")).Select
   Selection.Delete
 End Sub

because it applies to 2 sheets. Unfortunately it wasn't wise idea, because it returns the pictures ID in array, that are going to change as the process repeats. In turn I cannot really use the

          Sheets("BoQ Civils").Shapes(Sheets("BoQ Civils").Shapes.Count)

because I am afraid, that all images placed in this sheet will be removed.

Is there any solution to delete these images quickly?

1 Answer 1

2

Let me break this down:

Sheets("BoQ Civils").Shapes(Sheets("BoQ Civils").Shapes.Count)

Sheets("BoQ Civils").Shapes.Count will return number of images (shapes in general) you have in sheet BoQ Civils, so Sheets("BoQ Civils").Shapes(Sheets("BoQ Civils").Shapes.Count) will return image with the last index, so image, which was added last.

In turn, you are safe - you don't want delete all pictures in sheet, just the last one.

And this is what you after, from what I understand.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.