Application.OnUndo "Undo the last macro", "UndoMyMacro"
Open in new window
Dim WSThis As Worksheet
Dim WS As Worksheet
Dim Img As OLEObject
Dim WSImg As OLEObject
Set WS = ActiveSheet
Set WSThis = ThisWorkbook.Worksheets("Main")
On Error Resume Next
Set WSImg = WS.OLEObjects("Image1")
If Err = 0 Then
Set Img = WSThis.OLEObjects("Image1")
On Error GoTo 0
Your question, your audience. Choose who sees your identity—and your question—with question security.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
Join the community of 500,000 technology professionals and ask your questions.
Join & Ask a Question
Join our community for more solutions or to ask questions.
For immediate help use Live now!