ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Button event clicked problem (https://www.excelbanter.com/excel-programming/279525-button-event-clicked-problem.html)

Marek Cvrk

Button event clicked problem
 
Hello,
When I run macro using button event clicked, macro is not able to
execute some actions on range object like calling of delete method or
setting of numberformat property. It falls on runtime error 1004 "delete
method of range class failed". But, when I run macro different way (workbook
open event or directly from VB editor), no error occures. I seems like some
protection problem, but I think, all protection is turned off.
Tank You for any help.
Marek



Ron de Bruin

Button event clicked problem
 
Change the takefocusonclick property to false of the button
This is a bug in Excel 97

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Marek Cvrk" wrote in message ...
Hello,
When I run macro using button event clicked, macro is not able to
execute some actions on range object like calling of delete method or
setting of numberformat property. It falls on runtime error 1004 "delete
method of range class failed". But, when I run macro different way (workbook
open event or directly from VB editor), no error occures. I seems like some
protection problem, but I think, all protection is turned off.
Tank You for any help.
Marek





Tom Ogilvy

Button event clicked problem
 
Sounds like you are using Excel 97. Change the takeFocusOnClick property of
the commandbutton to false or put this as the first line of the code:

ActiveCell.Activate

--
Regards,
Tom Ogilvy


"Marek Cvrk" wrote in message
...
Hello,
When I run macro using button event clicked, macro is not able to
execute some actions on range object like calling of delete method or
setting of numberformat property. It falls on runtime error 1004 "delete
method of range class failed". But, when I run macro different way

(workbook
open event or directly from VB editor), no error occures. I seems like

some
protection problem, but I think, all protection is turned off.
Tank You for any help.
Marek






All times are GMT +1. The time now is 02:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com