Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
 
Posts: n/a
Default Delete a rectangle using a macro

I'm trying to delete rectangles from 170 worksheets in a workbook. I
tried highlighting each worksheet and it won't allow me to make the
change. I tried recording a macro to perform the function, but there
is an error message that says the rectangle is not found. Does anyone
know how to change this statement to have the macro run?

ActiveSheet.Shapes("Rectangle 4").Select
Selection.Characters.Text = _

  #2   Report Post  
Jim Rech
 
Posts: n/a
Default

This deletes all the rectangles in the active workbook.

Sub DelRects()
Dim WS As Worksheet
For Each WS In Worksheets
WS.Rectangles.Delete
Next
End Sub

I don't think that's what you want to do but at least this will give you an
opportunity to clarify.

--
Jim
wrote in message
oups.com...
| I'm trying to delete rectangles from 170 worksheets in a workbook. I
| tried highlighting each worksheet and it won't allow me to make the
| change. I tried recording a macro to perform the function, but there
| is an error message that says the rectangle is not found. Does anyone
| know how to change this statement to have the macro run?
|
| ActiveSheet.Shapes("Rectangle 4").Select
| Selection.Characters.Text = _
|


  #3   Report Post  
bj
 
Posts: n/a
Default

there is a good chance that the rectangle has a different name on each sheet.
if you want to delete all shapes on a sheet

Sub spdel()
For n = ActiveSheet.Shapes.Count To 1 Step -1
ActiveSheet.Shapes(n).Delete
Next n
End Sub

you can make it more complex by looking for Rec in the name of the shape if
it os only retangles you want to delete

" wrote:

I'm trying to delete rectangles from 170 worksheets in a workbook. I
tried highlighting each worksheet and it won't allow me to make the
change. I tried recording a macro to perform the function, but there
is an error message that says the rectangle is not found. Does anyone
know how to change this statement to have the macro run?

ActiveSheet.Shapes("Rectangle 4").Select
Selection.Characters.Text = _


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
delete personal macro kalz Excel Discussion (Misc queries) 3 March 22nd 05 03:13 AM
Macro to delete data in 'green' cells only Steve Excel Worksheet Functions 7 March 19th 05 01:40 PM
Cannot delete a macro Jeff B Excel Discussion (Misc queries) 3 February 15th 05 12:43 AM
How to delete a macro that has been assigned to run when workshee. tcsigecan Excel Worksheet Functions 1 December 28th 04 10:11 PM
Macro to delete a macro Spanky Excel Worksheet Functions 1 December 16th 04 02:43 AM


All times are GMT +1. The time now is 02:28 AM.

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

About Us

"It's about Microsoft Excel"