Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Finding a button
During a macro, if there is a "Button" on the activesheet,
I would like to delete it. Activesheet.Shapes("Button 1").Cut will get rid of it, but sometimes the macro is run a second time and then there is no button to cut and I get an error message. Is there an IF statement to find shapes? TIA, Brad E. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Finding a button
The easy solution is just to skip the error if it happens:
On Error Resume Next Activesheet.Shapes("Button 1").Cut On Error Goto 0 -- Regards Juan Pablo González "Brad E" wrote in message ... During a macro, if there is a "Button" on the activesheet, I would like to delete it. Activesheet.Shapes("Button 1").Cut will get rid of it, but sometimes the macro is run a second time and then there is no button to cut and I get an error message. Is there an IF statement to find shapes? TIA, Brad E. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Finding a button
Just put On Resume Next before the delete.
-- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Brad E" wrote in message ... During a macro, if there is a "Button" on the activesheet, I would like to delete it. Activesheet.Shapes("Button 1").Cut will get rid of it, but sometimes the macro is run a second time and then there is no button to cut and I get an error message. Is there an IF statement to find shapes? TIA, Brad E. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Undo button and redo button quit | Excel Discussion (Misc queries) | |||
Inserting a Graphic on a Button when the Button is Assigned to a M | Excel Discussion (Misc queries) | |||
insert row above button (retrieve position of button) | Excel Discussion (Misc queries) | |||
How do I lock a radio button group if a N/A button is selected | Excel Discussion (Misc queries) | |||
Delete a custom button by holding down the ALT key and dragging the button off the toolbar | Excel Programming |