View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Please help Please help is offline
external usenet poster
 
Posts: 75
Default Please help with my code

Hi Carim,

Thanks for the code. I take your code and make a few changes to suit my
needs, and it does not seem to work. Can you help me more? Below is my
modified code.

In addition to removing the shapes, I also like to include the code to
message the users the # of shapes got removed and referencing the cells
selected and worksheet.

In addition, how does your code know what type of shape to remove because I
only want to remove the shapes which are 13 (msoLinkedPicture).

Thanks.

Dim myshape As Shape
Dim rng As Range
dim cCount as Integer
For Each myshape In ActiveSheet.Shapes
Set rng = myshape.TopLeftCell
If Intersect(rng, ActiveCell) Is Nothing Then
Else
cCount = cCount + 1
myshape.Delete
End If
Next myshape
MsgBox "You just removed " & cCount & " check marks in highlighted cells
'" & rng.Name & "' of the Worksheet '" & ActiveSheet.Name & "'."


"Carim" wrote:

Hi,

Below is my code to delete text boxes ...
You can adapt it to your situation :

Sub DeleteTextBox()
Dim myshape As Shape
Dim rng As Range
For Each myshape In ActiveSheet.Shapes
Set rng = myshape.TopLeftCell
If Intersect(rng, ActiveCell) Is Nothing Then
'do nothing
Else
myshape.Delete
End If
Next myshape
End Sub

HTH