VB to identify and delete any text box on a sheet

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

*** Sent via Developersdex http://www.developersdex.com ***
 
G

Gary''s Student

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
 
B

Bob Phillips

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)
 
T

Tom Ogilvy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top