VB to identify and delete any text box on a sheet

  • Thread starter Thread starter Darin Kramer
  • Start date Start date
D

Darin Kramer

Hi There,

I have a sheet called "Master" on which through macros several text
boxes have been inadvertenly pasted. I want to run a macro that will
select and delete all text boxes on a sheet (irrespecitve of the text
box number...)

Thanks!!!

Regards

D
 
This will remove text boxes inserted from the drawing toolbar:

Sub tboxkiller()
Dim s As Shape
For Each s In ActiveSheet.Shapes
s.Delete
Next
End Sub

1. select the worksheet
2. run the macro from that sheet
 
You need to be more careful than that. Your code will also delete the arrows
on a data validation cell, or the autofilter dropdown arrow.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Possibly

Sub DeleteTextboxes()
dim tbox as TextBox
for each tbox in worksheets("Master").TextBoxes
tbox.Delete
Next
End Sub


or
Sub DeleteTextboxesA()
worksheets("Master").Textboxes.Delete
End Sub
 
Back
Top