Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: Thanks to all NOW OK Undo macro, now with code

  1. #1
    Board Regular
    Join Date
    May 2002
    Location
    wirral uk
    Posts
    104
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #2
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  3. #3

    Join Date
    Mar 2002
    Posts
    20
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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.

  4. #4
    Board Regular
    Join Date
    May 2002
    Location
    wirral uk
    Posts
    104
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #5
    Board Regular
    Join Date
    May 2002
    Location
    Gothenburg, Sweden
    Posts
    74
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •