View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Removing diagonal lines created on sheet

Take a look at Ron de Bruin's site:
http://www.rondebruin.nl/controlsobjectsworksheet.htm

You'll see how he limits what he deletes by looking at the shape.type.

Option Explicit
Sub testme()
Dim shp As Shape
For Each shp In Worksheets("sheet1").Shapes
If shp.Type = msoLine Then
shp.Delete
End If
Next shp
End Sub

If there aren't too many lines, you may be able to use:

Sub testme2()
Worksheets("Sheet1").Lines.Delete
End Sub

If you decide you want to keep some lines and delete others, you may want to
give a name to each when you add them. Using a nice naming convention may make
it easier:

Option Explicit
Sub testme()
Dim shp As Shape
For Each shp In Worksheets("sheet1").Shapes
if lcase(shp.name) like lcase("deletemelater*") then
shp.Delete
End If
Next shp
End Sub

Memphis wrote:

Thank you Sheelo,
But i do have including the CheckBox many other option buttons created from
the Control Toolbox. i ran a test and it deletes the existing option buttons
and the chkboxE4NA.
I also have grouped many of the option buttons since they are Yes and No
answers.

What to do?

Thanks

"Sheeloo" wrote:

If there is not other shape on the sheets then add similar code to the
uncheck event

For Each shp In ActiveSheet.Shapes
shp.Delete
Next


--

Dave Peterson