Excel Macro
发布时间:2026-10-05 | 浏览:1
I have created an Excel macro that is not working because part of the macro pastes special as a picture.
When pasting as a picture Excel adds this line after the paste as picture
ActiveSheet.Shapes.Range(Array("Picture 28")).Select
As part of the same macro I try to delete the "picture" from the week before -
ActiveSheet.Shapes.Range(Array("Picture … See more ActiveSheet.Shapes.Range(Array("Picture 25")).Select
Because the number in the Picture name changes with each run of the macro, I receive an error message saying the item does not exist.
Does anyone know a way around this?
I no longer need an answer - I saved the selection as - Save As Linked Picture so I no longer need to update as part of the macro. How simple, wish I would have thought of it sooner! Thank you.
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
I know you don't need an answer, but another solution is to name the picture after you have inserted it:
'Insert the picture - delete it first if it already exists
On Error Resume Next
ActiveSheet.Shapes("MyPicture").Delete
On Error GoTo 0
ActiveSheet.Pictures.Insert("C:\picture.jpg").Select
Selection.Name = "MyPicture"
Though the specific code depends on the rest of your macro...
1 additional answer
Anonymous 2014-01-10T19:28:12+00:00 Thank you! 0 comments No comments