![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: May 2002
Location: wirral uk
Posts: 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 ] |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
|
|
|
|
|
|
#3 | |
|
Join Date: Mar 2002
Posts: 20
|
Quote:
Post your code. It should be simple to do a macro to delete whatever the "diagram" is that your macro created. |
|
|
|
|
|
|
#4 |
|
Board Regular
Join Date: May 2002
Location: wirral uk
Posts: 104
|
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 |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: May 2002
Location: Gothenburg, Sweden
Posts: 74
|
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
__________________
/Niklas Jansson |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|