Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default VB to identify and delete any text box on a sheet

Dim mpOLE As Object
For Each mpOLE In ActiveSheet.OLEObjects
If TypeName(mpOLE.Object) = "TextBox" Then
mpOLE.Delete
End If
Next mpOLE


--
---
HTH

Bob

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



"Darin Kramer" wrote in message
...


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 ***



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 397
Default VB to identify and delete any text box on a sheet



Bob,

I added Sheets("Master").select to get it to go to the correct sheet.
However the Macro does not work - ie it skips over the first if, ie
doesnt find any text boxes to delete...
Am I doing something wrong...?

Regards
D

*** Sent via Developersdex http://www.developersdex.com ***
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default VB to identify and delete any text box on a sheet

Darin,

Where did the textboxes come from. I am assuming the controls toolbox, but
maybe not?

--
---
HTH

Bob

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



"Darin Kramer" wrote in message
...


Bob,

I added Sheets("Master").select to get it to go to the correct sheet.
However the Macro does not work - ie it skips over the first if, ie
doesnt find any text boxes to delete...
Am I doing something wrong...?

Regards
D

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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default VB to identify and delete any text box on a sheet

If they are shapes from the drawing toolbar, try

Sub DeleteTextBoxes()
Dim shp As Shape

For Each shp In Worksheets("Master").Shapes
If shp.Type = msoTextBox Then
shp.Delete
End If
Next shp
End Sub


--
---
HTH

Bob

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



"Darin Kramer" wrote in message
...


Bob,

I added Sheets("Master").select to get it to go to the correct sheet.
However the Macro does not work - ie it skips over the first if, ie
doesnt find any text boxes to delete...
Am I doing something wrong...?

Regards
D

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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 397
Default VB to identify and delete any text box on a sheet


Thanks Bob - works PERFECTLY!


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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Identify (not delete) exact duplicates Gene Excel Discussion (Misc queries) 2 June 19th 09 06:21 PM
Identify the duplicate and delete with details in excel mat Excel Discussion (Misc queries) 0 November 15th 06 09:03 PM
How to identify text (compare) in one sheet, then move it another mag7417[_3_] Excel Programming 4 December 14th 05 02:54 PM
How to identify text (compare) in one sheet, then move it another mag7417[_4_] Excel Programming 0 December 14th 05 10:38 AM
How can I programatically identify and delete an image? Henry Stock Excel Programming 2 February 22nd 05 07:21 PM


All times are GMT +1. The time now is 09:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"