![]() |
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 |
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 |
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 |
All times are GMT +1. The time now is 08:31 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com