I am using Excel 2007
I have a worksheet called Sheet1
On this worksheet I have two option buttons :
These two option buttons can be deleted by a macro depending on what a user does.
I need a macro that can do the following:
Check if ActiveSheet.Shapes("OptionButton1") and ActiveSheet.Shapes("OptionButton2") physically exists on Sheet1.
If they do not then
(continue with the code that follows eg. the rest of the macro)
If they do then
(run my delete code and then continue on)
There is a lots of examples via google on how to check if an object exists using Excel VBA but a lot of it seems very complicated which is fine but I would like something simple and easy to implement.
Something like:
which I have tried and of course it does not work.
Many thanks
I have a worksheet called Sheet1
On this worksheet I have two option buttons :
Code:
ActiveSheet.Shapes("OptionButton1")
ActiveSheet.Shapes("OptionButton2")
These two option buttons can be deleted by a macro depending on what a user does.
I need a macro that can do the following:
Check if ActiveSheet.Shapes("OptionButton1") and ActiveSheet.Shapes("OptionButton2") physically exists on Sheet1.
If they do not then
(continue with the code that follows eg. the rest of the macro)
If they do then
(run my delete code and then continue on)
There is a lots of examples via google on how to check if an object exists using Excel VBA but a lot of it seems very complicated which is fine but I would like something simple and easy to implement.
Something like:
Code:
ActiveSheet.Shapes("OptionButton1").exists then
(run my delete code and then continue on)
which I have tried and of course it does not work.
Many thanks