Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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
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
Undo button and redo button quit stillkicking Excel Discussion (Misc queries) 7 November 14th 09 04:40 PM
Inserting a Graphic on a Button when the Button is Assigned to a M smck Excel Discussion (Misc queries) 2 October 27th 09 04:46 PM
insert row above button (retrieve position of button) Max Excel Discussion (Misc queries) 3 November 7th 07 06:27 PM
How do I lock a radio button group if a N/A button is selected worry a lot Excel Discussion (Misc queries) 2 May 21st 05 08:33 PM
Delete a custom button by holding down the ALT key and dragging the button off the toolbar Stephen[_8_] Excel Programming 0 April 4th 04 02:22 PM


All times are GMT +1. The time now is 11:40 AM.

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"