Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default delete group not object

Hi,
I have sheet, where there is a picture named Object 1 (an in formula bar is
formula =INSERT("Word.Picture.8";"") ) - this I need to leave on the Sheet.
Then there is Group11, which I need to delete

I have this part of macro but it deletes both objects.


Sheets(hlavni).Select
ActiveSheet.DrawingObjects.Delete

I tried also this code, but it didn't find anything.

For Each shp In ActiveSheet.Shapes
If shp.Type = msoGroup Then
shp.Delete
End If
Next shp

Could anyone find a mistake?

Thanks karmela
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default delete group not object

Your second code

For Each shp In ActiveSheet.Shapes
If shp.Type = msoGroup Then
shp.Delete
End If
Next shp

As the code refers to the ActiveSheet, make sure you have the one with the
objects selected when you run the code. Alternatively add an explicit
reference to the sheet. Also check are the sheets/objects protected?

For Each shp in Sheets("mySheet").Shapes

etc....

--

Regards,
Nigel




"karmela" wrote in message
...
Hi,
I have sheet, where there is a picture named Object 1 (an in formula bar
is
formula =INSERT("Word.Picture.8";"") ) - this I need to leave on the
Sheet.
Then there is Group11, which I need to delete

I have this part of macro but it deletes both objects.


Sheets(hlavni).Select
ActiveSheet.DrawingObjects.Delete

I tried also this code, but it didn't find anything.

For Each shp In ActiveSheet.Shapes
If shp.Type = msoGroup Then
shp.Delete
End If
Next shp

Could anyone find a mistake?

Thanks karmela


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default delete group not object

Hi,

in the code before I have reference to the right sheet with the explicit
name, I hade there the first code that goes ok, but deletes more then I want
to...

karmela

"Nigel" wrote:

Your second code

For Each shp In ActiveSheet.Shapes
If shp.Type = msoGroup Then
shp.Delete
End If
Next shp

As the code refers to the ActiveSheet, make sure you have the one with the
objects selected when you run the code. Alternatively add an explicit
reference to the sheet. Also check are the sheets/objects protected?

For Each shp in Sheets("mySheet").Shapes

etc....

--

Regards,
Nigel




"karmela" wrote in message
...
Hi,
I have sheet, where there is a picture named Object 1 (an in formula bar
is
formula =INSERT("Word.Picture.8";"") ) - this I need to leave on the
Sheet.
Then there is Group11, which I need to delete

I have this part of macro but it deletes both objects.


Sheets(hlavni).Select
ActiveSheet.DrawingObjects.Delete

I tried also this code, but it didn't find anything.

For Each shp In ActiveSheet.Shapes
If shp.Type = msoGroup Then
shp.Delete
End If
Next shp

Could anyone find a mistake?

Thanks karmela


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default delete group not object

Your first code works because it deletes all drawing objects. The 2nd code
should only delete the drawing objects that have been grouped, it does work
if you select the sheet before running the code, alternatively add an
explicit reference as I suggested.

Make sure objects and sheets are not protected

--

Regards,
Nigel




"karmela" wrote in message
...
Hi,

in the code before I have reference to the right sheet with the explicit
name, I hade there the first code that goes ok, but deletes more then I
want
to...

karmela

"Nigel" wrote:

Your second code

For Each shp In ActiveSheet.Shapes
If shp.Type = msoGroup Then
shp.Delete
End If
Next shp

As the code refers to the ActiveSheet, make sure you have the one with
the
objects selected when you run the code. Alternatively add an explicit
reference to the sheet. Also check are the sheets/objects protected?

For Each shp in Sheets("mySheet").Shapes

etc....

--

Regards,
Nigel




"karmela" wrote in message
...
Hi,
I have sheet, where there is a picture named Object 1 (an in formula
bar
is
formula =INSERT("Word.Picture.8";"") ) - this I need to leave on the
Sheet.
Then there is Group11, which I need to delete

I have this part of macro but it deletes both objects.


Sheets(hlavni).Select
ActiveSheet.DrawingObjects.Delete

I tried also this code, but it didn't find anything.

For Each shp In ActiveSheet.Shapes
If shp.Type = msoGroup Then
shp.Delete
End If
Next shp

Could anyone find a mistake?

Thanks karmela



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
Object error with Group & Ungroup in Excel Denis J. Excel Worksheet Functions 0 May 10th 07 11:26 AM
Change multiple object group name GreenBean Excel Discussion (Misc queries) 7 July 23rd 06 10:27 PM
Change multiple object group name GreenBean Excel Programming 7 July 23rd 06 10:27 PM
Data, Group got error message Cannot shift object off sheet Matt Excel Discussion (Misc queries) 1 October 4th 05 12:12 AM
what object group does this reside in Ricky M. Medley Excel Programming 1 December 9th 03 11:29 PM


All times are GMT +1. The time now is 03:07 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"