Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 1
Default Deleting "hidden" charts on a worksheet

Hi everyone,

I've been playing around w/ a worksheet that contains data and charts,
inserting and removing multiple rows at a time. Unfortunately, I did
not change the properties of the charts and they were all set to "Move
and Size w/ Cells". When I deleted a series of rows, these charts
disappeared and left a line across the spreadsheet where they used to
be. I've tried everything to get rid of them (because they are now
calculating incorrectly and giving me error messages), including
deleting the rows where they appear, trying to select them on the
sheet, but nothing works. The best scenario would be to select and
delete them but obviously this isn't possible. Any thoughts?

Thanks,
Louis

  #3   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 6,582
Default Deleting "hidden" charts on a worksheet

A little more discriminating:

Sub DeleteThinShapes()
Dim s As Shape
For Each s In ActiveSheet.Shapes
If s.Height < 1 or s.Width < 1 Then
s.Delete
End If
Next
End Sub

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

"Don Guillett" wrote in message
...
Try this. Be advised it will delete all shapes on the active sheet. Is
this what you want to do?
Sub deleteshapes()
For Each s In ActiveSheet.Shapes
s.Delete
Next s
End Sub


--
Don Guillett
SalesAid Software

wrote in message
oups.com...
Hi everyone,

I've been playing around w/ a worksheet that contains data and charts,
inserting and removing multiple rows at a time. Unfortunately, I did
not change the properties of the charts and they were all set to "Move
and Size w/ Cells". When I deleted a series of rows, these charts
disappeared and left a line across the spreadsheet where they used to
be. I've tried everything to get rid of them (because they are now
calculating incorrectly and giving me error messages), including
deleting the rows where they appear, trying to select them on the
sheet, but nothing works. The best scenario would be to select and
delete them but obviously this isn't possible. Any thoughts?

Thanks,
Louis





  #4   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 361
Default Deleting "hidden" charts on a worksheet

Hello John. I read your note and the code worked perfectly (as designed) but
I have a bunch of charts that are hidden (don't know why). Even when I use
your discriminating code it gets all charts, buttons, everything. Is there a
way to find them and delete them one at a time? Thanks in advance. Carl

"Jon Peltier" wrote:

A little more discriminating:

Sub DeleteThinShapes()
Dim s As Shape
For Each s In ActiveSheet.Shapes
If s.Height < 1 or s.Width < 1 Then
s.Delete
End If
Next
End Sub

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

"Don Guillett" wrote in message
...
Try this. Be advised it will delete all shapes on the active sheet. Is
this what you want to do?
Sub deleteshapes()
For Each s In ActiveSheet.Shapes
s.Delete
Next s
End Sub


--
Don Guillett
SalesAid Software

wrote in message
oups.com...
Hi everyone,

I've been playing around w/ a worksheet that contains data and charts,
inserting and removing multiple rows at a time. Unfortunately, I did
not change the properties of the charts and they were all set to "Move
and Size w/ Cells". When I deleted a series of rows, these charts
disappeared and left a line across the spreadsheet where they used to
be. I've tried everything to get rid of them (because they are now
calculating incorrectly and giving me error messages), including
deleting the rows where they appear, trying to select them on the
sheet, but nothing works. The best scenario would be to select and
delete them but obviously this isn't possible. Any thoughts?

Thanks,
Louis






  #5   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 2,489
Default Deleting "hidden" charts on a worksheet

Hi,

Jon's code should only be deleting shapes that have a width or height of
less than 1., so I'm not sure why it's deleting everything for you.

This small mod will require confirmation before deleting. It will also
highlight the cells that the shape in covering.

Sub DeleteThinShapes()
Dim s As Shape
Dim strMsg As String
Dim rngOrig As Range

Set rngOrig = ActiveCell
For Each s In ActiveSheet.Shapes
If s.Height < 1 Or s.Width < 1 Then
Application.Goto Range(s.TopLeftCell, s.BottomRightCell)
strMsg = "Delete " & s.Name & _
" which is over cells " & Selection.Address
If MsgBox(strMsg, vbYesNo) = vbYes Then s.Delete
End If
Next
rngOrig.Select

End Sub

Cheers
Andy

Carl wrote:
Hello John. I read your note and the code worked perfectly (as designed) but
I have a bunch of charts that are hidden (don't know why). Even when I use
your discriminating code it gets all charts, buttons, everything. Is there a
way to find them and delete them one at a time? Thanks in advance. Carl

"Jon Peltier" wrote:


A little more discriminating:

Sub DeleteThinShapes()
Dim s As Shape
For Each s In ActiveSheet.Shapes
If s.Height < 1 or s.Width < 1 Then
s.Delete
End If
Next
End Sub

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

"Don Guillett" wrote in message
...

Try this. Be advised it will delete all shapes on the active sheet. Is
this what you want to do?
Sub deleteshapes()
For Each s In ActiveSheet.Shapes
s.Delete
Next s
End Sub


--
Don Guillett
SalesAid Software

wrote in message
egroups.com...

Hi everyone,

I've been playing around w/ a worksheet that contains data and charts,
inserting and removing multiple rows at a time. Unfortunately, I did
not change the properties of the charts and they were all set to "Move
and Size w/ Cells". When I deleted a series of rows, these charts
disappeared and left a line across the spreadsheet where they used to
be. I've tried everything to get rid of them (because they are now
calculating incorrectly and giving me error messages), including
deleting the rows where they appear, trying to select them on the
sheet, but nothing works. The best scenario would be to select and
delete them but obviously this isn't possible. Any thoughts?

Thanks,
Louis






--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info


  #6   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 361
Default Deleting "hidden" charts on a worksheet

Thanks, Andy. This works great!

"Andy Pope" wrote:

Hi,

Jon's code should only be deleting shapes that have a width or height of
less than 1., so I'm not sure why it's deleting everything for you.

This small mod will require confirmation before deleting. It will also
highlight the cells that the shape in covering.

Sub DeleteThinShapes()
Dim s As Shape
Dim strMsg As String
Dim rngOrig As Range

Set rngOrig = ActiveCell
For Each s In ActiveSheet.Shapes
If s.Height < 1 Or s.Width < 1 Then
Application.Goto Range(s.TopLeftCell, s.BottomRightCell)
strMsg = "Delete " & s.Name & _
" which is over cells " & Selection.Address
If MsgBox(strMsg, vbYesNo) = vbYes Then s.Delete
End If
Next
rngOrig.Select

End Sub

Cheers
Andy

Carl wrote:
Hello John. I read your note and the code worked perfectly (as designed) but
I have a bunch of charts that are hidden (don't know why). Even when I use
your discriminating code it gets all charts, buttons, everything. Is there a
way to find them and delete them one at a time? Thanks in advance. Carl

"Jon Peltier" wrote:


A little more discriminating:

Sub DeleteThinShapes()
Dim s As Shape
For Each s In ActiveSheet.Shapes
If s.Height < 1 or s.Width < 1 Then
s.Delete
End If
Next
End Sub

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

"Don Guillett" wrote in message
...

Try this. Be advised it will delete all shapes on the active sheet. Is
this what you want to do?
Sub deleteshapes()
For Each s In ActiveSheet.Shapes
s.Delete
Next s
End Sub


--
Don Guillett
SalesAid Software

wrote in message
egroups.com...

Hi everyone,

I've been playing around w/ a worksheet that contains data and charts,
inserting and removing multiple rows at a time. Unfortunately, I did
not change the properties of the charts and they were all set to "Move
and Size w/ Cells". When I deleted a series of rows, these charts
disappeared and left a line across the spreadsheet where they used to
be. I've tried everything to get rid of them (because they are now
calculating incorrectly and giving me error messages), including
deleting the rows where they appear, trying to select them on the
sheet, but nothing works. The best scenario would be to select and
delete them but obviously this isn't possible. Any thoughts?

Thanks,
Louis






--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info

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
Deleting a worksheet but retaining values from the worksheet. [email protected] Excel Discussion (Misc queries) 1 September 13th 06 03:00 PM
Deleting a worksheet but retaining values from the worksheet. [email protected] Excel Discussion (Misc queries) 1 September 13th 06 02:48 PM
Excel: Relative worksheet references? Busy Beaver Excel Discussion (Misc queries) 2 September 10th 06 04:32 PM
Confirm before deleting a worksheet? edeil Excel Discussion (Misc queries) 1 January 28th 06 02:44 AM
Copying Charts and graphs to another worksheet with formulas bebz Excel Worksheet Functions 1 December 31st 05 11:45 AM


All times are GMT +1. The time now is 11:21 PM.

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"