Hi everyone,
I have written a macro (Macro 1) that, upon certain conditions being fulfilled, it copies two separate pictures from a worksheet and pastes it on a different worksheet. I then proceeded to write a different macro (Macro 2) upon which I want those two particular pictures to be deleted from the worksheet they were pasted on in order to enable the user to choose different options, which will lead to different pictures being copied and pasted.
My problem is that everytime Macro 1 is executed, the picture references change on the worksheet to which they are copied. Therefore Macro 2 can't select them for deletion.
How can I change the code in order to delete the pictures from the worksheet again?
Code for Macro 1:
If Range("O5").Value = "Worksheet one" Then
Sheets("Worksheet two").Select
ActiveWindow.SmallScroll Down:=6
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ChartArea.Copy
Sheets("Worksheet three").Select
Range("E52").Select
ActiveSheet.PasteSpecial Format:="Picture (PNG)", Link:=False, _
DisplayAsIcon:=False
Sheets("Worksheet two").Select
ActiveSheet.Shapes.Range(Array("TextBox 2")).Select
Selection.Copy
Sheets("Worksheet three").Select
Range("G73").Select
ActiveSheet.PasteSpecial Format:="Picture (PNG)", Link:=False, _
DisplayAsIcon:=False
Range("N74").Select
Code for Macro 2:
ActiveWindow.SmallScroll Down:=60
ActiveSheet.Shapes.Range(Array("Picture 9")).Select
Selection.Delete
ActiveSheet.Shapes.Range(Array("Picture 8")).Select
Selection.Delete
ActiveWindow.SmallScroll Down:=-87
Sheets("Worksheet four").Select
Thank you in advance,
Corneli
Bookmarks