Remove Autoshape Line...nothing is working

sm5948

New Member
Joined
Jan 12, 2008
Messages
13
I have a shared document I created. In has been in use for 4 months with no problems. This last month, 3 other individuals not very cognizant with Excel were using the document. One of these individuals placed a 'line' in the document. It appears that they used Autoshapes to draw the line.

I want to remove the line they have drawn. It sounds like a simple problem, but I've tried:

* Edit, Clear, All
* Edit, Cut
*Right Click the 'line', Format AutoShape, under Colors and Lines, change Line Color to No Line
* Delete a series of rows with the line in the middle row,

Everything I’ve tried to eliminate this line is not working and this is very frustrating. This type of 'line formatting' is rampant in the department and has appeared in multiple documents, which I've had to recreate.

I'm not sure what they did, so I'm not sure how to correct this issue. I'm presuming they used AutoShapes. There are two small white circles - above and below the line. And a small green circle above the top white circle that has circular arrows surround it....perhaps a rotate feature. Any suggestions are appreciated.

Stephanie
 
Perhaps there are other shapes which we didn't see?
Or did you mean that the shapes were "coming back"?

When deleting shapes, I trie to be careful: the following code is less carefull, which means it will delete all shapes.

Code:
Option Explicit
 
Sub remove_objects()
'Erik Van Geit
'061012
'NOT deleted:
'validation dropdown
'comments
Dim obj As Object
Dim msg As String
Dim rng As Range
 
Set rng = Cells 'Range("FTERange")
msg = "Are you sure you want to delete all shapes from the range " & rng.Address(0, 0) & "?" & vbLf & _
"(except validationdropdowns and comments)"
If MsgBox(msg, 36, "DELETE ALL OBJECTS") = vbNo Then Exit Sub
 
    For Each obj In ActiveSheet.Shapes
        With obj
            Select Case .Type
            Case 8
            On Error Resume Next
            'validation dropdown can not be selected
            .Select
                If Err Then
                Err.Clear
                Else
                If Not Intersect(.TopLeftCell, rng) Is Nothing Then .Delete
                End If
            Case 4
            'comments not deleted
            Case Else
            If Not Intersect(.TopLeftCell, rng) Is Nothing Then .Delete
            End Select
        End With
    Next obj
End Sub
if you want to delete all shapes on all sheets

put on top
Code:
Dim sht as WorkSheet

add 2 lines
Code:
For each sht in ActiveWorkbook.Worksheets
     For Each obj In sht.Shapes
'other code
    Next obj
Next sht
 
Last edited:
Upvote 0

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
I didn't see that the code had a range restriction.

You can use this
Code:
Option Explicit
 
Sub remove_objects()
'Erik Van Geit
'061012
'NOT deleted:
'validation dropdown
'comments
 
Dim obj As Object
Dim msg As String
Dim sht As Worksheet

msg = "Are you sure you want to delete all shapes from all sheets?" & vbLf & _
"(except validationdropdowns and comments)"
If MsgBox(msg, 36, "DELETE ALL OBJECTS") = vbNo Then Exit Sub
 
    For Each sht In ActiveWorkbook.Worksheets
         For Each obj In sht.Shapes
            With obj
                Select Case .Type
                Case 8
                On Error Resume Next
                'validation dropdown can not be selected
                .Select
                    If Err Then
                    Err.Clear
                    .Delete
                    End If
                Case 4
                'comments not deleted
                Case Else
                .Delete
                End Select
            End With
        Next obj
    Next sht
 
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,487
Messages
6,125,082
Members
449,205
Latest member
Healthydogs

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