ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macroo assigned to CommandButton (https://www.excelbanter.com/excel-programming/362191-macroo-assigned-commandbutton.html)

ellflocko

Macroo assigned to CommandButton
 
I have a macro in Excel that works just fine when I run it from the toolbar.
However, when I create a CommandButton on the spreadsheet itself and copy the
code from the macro, it will not run as hit encounters an error and goes into
debugging. Can anyone shed any light on this as to why and what I have to do
to fix it? Thanks so much...

Bernie Deitrick

Macroo assigned to CommandButton
 
ellflocko,

You may need to set the TakeFocusOnClick property of teh commandbutton to False to allow your code
to work properly when assigned to a commandbutton.

HTH,
Bernie
MS Excel MVP


"ellflocko" <u22156@uwe wrote in message news:60af7618c3a7f@uwe...
I have a macro in Excel that works just fine when I run it from the toolbar.
However, when I create a CommandButton on the spreadsheet itself and copy the
code from the macro, it will not run as hit encounters an error and goes into
debugging. Can anyone shed any light on this as to why and what I have to do
to fix it? Thanks so much...




ellflocko via OfficeKB.com

Macroo assigned to CommandButton
 
I tried to do that but it did not work either. Any other thoughts? Thanks
for the reply.

Bernie Deitrick wrote:
ellflocko,

You may need to set the TakeFocusOnClick property of teh commandbutton to False to allow your code
to work properly when assigned to a commandbutton.

HTH,
Bernie
MS Excel MVP

I have a macro in Excel that works just fine when I run it from the toolbar.
However, when I create a CommandButton on the spreadsheet itself and copy the
code from the macro, it will not run as hit encounters an error and goes into
debugging. Can anyone shed any light on this as to why and what I have to do
to fix it? Thanks so much...


--
Message posted via http://www.officekb.com


All times are GMT +1. The time now is 03:12 PM.

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