Thanks to all NOW OK Undo macro, now with code

neills

Board Regular
Joined
May 6, 2002
Messages
104
I have a macro to paste a diagram into my spreadsheet but cannot undo or delete this diagram if needed. I need the sheet to be protected and the macro unprotects then reprotects any help would be appreciated. Neill
This message was edited by neills on 2002-05-08 04:34
This message was edited by neills on 2002-05-08 07:01
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
On 2002-05-08 03:11, neills wrote:
I have a macro to paste a diagram into my spreadsheet but cannot undo or delete this diagram if needed. I need the sheet to be protected and the macro unprotects then reprotects any help would be appreciated. Neill


Post your code.
It should be simple to do a macro to delete whatever the "diagram" is that your macro created.
 
Upvote 0
here is the code for the macro


Sub Start()
'
' Start Macro
' Macro recorded 07/05/2002 by Neill'
' Keyboard Shortcut: Ctrl+s
'

ActiveSheet.Unprotect password:="aaaaa"
ActiveSheet.Shapes("Group 436").Select
Selection.Copy
ActiveCell.Select
ActiveSheet.Paste
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, password:="aaaaa"
ActiveCell.Offset(0, 1).Select
End Sub



any good

Thanks Neill
 
Upvote 0
If you manage to save a reference to the shape then you should be able to do something like this:

Dim shpLast As Shape

Sub Start()
...
Application.OnUndo "Inserting Diagram", "DeleteDiagram"
End Sub

Sub DeleteDiagram
shpLast.Delete
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,534
Messages
6,114,186
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top