Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Please help with Count

Hello all,

I have a macro to delete the shapes in an active worksheet. After the
shapes are deleted, users will receive a message that they have been deleted.
In the message, I would like to insert the number of shapes that were
deleted. Can someone help me with counting those deleted shapes?

Below is my current code:

Dim cMarks As Shape

For Each cMarks In ActiveSheet.Shapes
If cMarks.Type = 13 Then cMarks.Delete
Next cMarks
MsgBox "You have removed " & cMarks & " check marks in Worksheet '" &
ActiveSheet.Name & "'."

Thanks.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Please help with Count

Hi

Have a look at this

Dim cMarks As Shape
Dim Counter As Double
For Each cMarks In ActiveSheet.Shapes
If cMarks.Type = 13 Then
cMarks.Delete
Counter = Counter + 1
End If
Next cMarks
MsgBox "You have removed " & Counter & " check marks in Worksheet '" & _
ActiveSheet.Name & "'."

Regards

Per

"Please Help" skrev i en meddelelse
...
Hello all,

I have a macro to delete the shapes in an active worksheet. After the
shapes are deleted, users will receive a message that they have been
deleted.
In the message, I would like to insert the number of shapes that were
deleted. Can someone help me with counting those deleted shapes?

Below is my current code:

Dim cMarks As Shape

For Each cMarks In ActiveSheet.Shapes
If cMarks.Type = 13 Then cMarks.Delete
Next cMarks
MsgBox "You have removed " & cMarks & " check marks in Worksheet '" &
ActiveSheet.Name & "'."

Thanks.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Please help with Count

See edited (air)code below.
HTH,
Keith

"Please Help" wrote in message
...
Hello all,

I have a macro to delete the shapes in an active worksheet. After the
shapes are deleted, users will receive a message that they have been
deleted.
In the message, I would like to insert the number of shapes that were
deleted. Can someone help me with counting those deleted shapes?

Below is my current code:

Dim cMarks As Shape

Dim cCount as Integer

cCount = 0

For Each cMarks In ActiveSheet.Shapes

If cMarks.Type = 13 Then
cMarks.Delete
cCount = cCount+1
End if

Next cMarks
MsgBox "You have removed " & cstr(cCount) & " check marks in Worksheet
'" &
ActiveSheet.Name & "'."

Thanks.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Please help with Count

Hi guys,

Thank you very much for your helps. The code works very well.

Can you help me one more thing?

Instead of deleting all the shapes in active sheet, can you help me with the
code to delete the shapes in the selected cells in the active sheet?

For example, if I select cells A1, B1, C5:G10 and when I run the macro, the
macro will only delete the shapes in those selected cells.

Thanks.

"Keith R" wrote:

See edited (air)code below.
HTH,
Keith

"Please Help" wrote in message
...
Hello all,

I have a macro to delete the shapes in an active worksheet. After the
shapes are deleted, users will receive a message that they have been
deleted.
In the message, I would like to insert the number of shapes that were
deleted. Can someone help me with counting those deleted shapes?

Below is my current code:

Dim cMarks As Shape

Dim cCount as Integer

cCount = 0

For Each cMarks In ActiveSheet.Shapes

If cMarks.Type = 13 Then
cMarks.Delete
cCount = cCount+1
End if

Next cMarks
MsgBox "You have removed " & cstr(cCount) & " check marks in Worksheet
'" &
ActiveSheet.Name & "'."

Thanks.




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
Count Employee Work Time - Don't Double-count Overlapping Apts. J Excel Worksheet Functions 0 April 27th 07 05:52 AM
Excel 2000, count, sort a list & count totals? sunslight Excel Worksheet Functions 1 April 9th 07 05:46 PM
Excel Count characters in a textbox to display character count? [email protected] Excel Programming 1 February 8th 07 06:31 AM
Count Intervals of 2 Numeric values in same Row and Return Count across Row Sam via OfficeKB.com Excel Worksheet Functions 12 September 24th 05 10:58 PM
Count Intervals of Filtered TEXT values in Column and Return Count across a Row Sam via OfficeKB.com Excel Worksheet Functions 9 July 31st 05 03:37 AM


All times are GMT +1. The time now is 03:52 PM.

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"