Results 1 to 2 of 2

Selecting all shapes in row range for deletion

Threaded View

  1. #1
    Registered User
    Join Date
    02-16-2013
    Location
    New York
    MS-Off Ver
    Excel 2003
    Posts
    24

    Selecting all shapes in row range for deletion

    I have a working spread sheet that adds, removes (for tracking), and erases custom rows in a workbook.

    My AddNMP macro is tied to the button on the "Forecast" sheet and is working as intended. The RemoveNMP (assigned to 'Remove Temp' control) and DeleteNMP (assigned to "X" control) macros are working for the most part, but I'm running into issues selecting and deleting the button not pressed.

    My goal is to allow the end user to select "Remove Temp" or "X" from primary table on the "Forecast" sheet.

    *"X" control selects the row and deletes it entirely, without inserting it anywhere else.

    *"Remove Temp" selects the row and inserts a parsed version (sans "Remove Temp" control) to the "Falloff" sheet. While "Remove Temp" parses itself out when being copied to "Falloff", I would like to keep the "X" control intact so that the user can edit the "Falloff" sheet using the same functionality.

    In both instances, I'm able to delete the active shape (the control selected), but I'm not able to select and delete the control next to it. I've tried using a For... Each statement to accomplish this, but it's not working. Any recommendations?

    '
    ' DeleteNMP Macro
    ' Macro selects, cuts, then deletes row range; for editing usage
    '
    
    Sub DeleteNMP()
            
    Dim ShpRng As Shape
            
        With ActiveSheet.Shapes(Application.Caller)
        
            .TopLeftCell.Select
            'Selects cell directly below shape control activated to begin macro
            
                ControlIndex = Application.Caller
                'Stores the control selected for deletion
            
            For Each ShpRng In ActiveSheet.Row
                If Not Intersect(ShpRng.TopLeftCell, Range.EntireRow) Is Nothing Then ShpRng.Delete
            Next ShpRng
            
            'ActiveSheet.Shapes(ControlIndex).Delete
            'Deletes row and control
    
        End With
    
    End Sub
    Attached Files Attached Files
    Last edited by dystopianprotagonist; 03-11-2013 at 12:31 PM. Reason: for clarity

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1