![]() |
Command button "selected"
When you click on a command button, it seem to be selected always and when a
user does not know that and they click the enter button, it runs the macro again. How do de-select the command button once it's clicked? Thanks |
Command button "selected"
Disable it within the assigned macro
ActiveSheet.Buttons(Application.Caller).Enabled = False -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "pgarcia" wrote in message ... When you click on a command button, it seem to be selected always and when a user does not know that and they click the enter button, it runs the macro again. How do de-select the command button once it's clicked? Thanks |
Command button "selected"
Are these commandbuttons on a worksheet?
Are you using xl97? If you are, then change the .takefocusonclick property to false. This was fixed in xl2k. If you ever use a control that doesn't have that property, you could also add a line to the code: activecell.activate (It'll work with the commandbutton, too.) pgarcia wrote: When you click on a command button, it seem to be selected always and when a user does not know that and they click the enter button, it runs the macro again. How do de-select the command button once it's clicked? Thanks -- Dave Peterson |
Command button "selected"
Oh, the command button takes you to another tab/sheet, so that did not work.
"Bob Phillips" wrote: Disable it within the assigned macro ActiveSheet.Buttons(Application.Caller).Enabled = False -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "pgarcia" wrote in message ... When you click on a command button, it seem to be selected always and when a user does not know that and they click the enter button, it runs the macro again. How do de-select the command button once it's clicked? Thanks |
Command button "selected"
Great, that did the trick.
"Dave Peterson" wrote: Are these commandbuttons on a worksheet? Are you using xl97? If you are, then change the .takefocusonclick property to false. This was fixed in xl2k. If you ever use a control that doesn't have that property, you could also add a line to the code: activecell.activate (It'll work with the commandbutton, too.) pgarcia wrote: When you click on a command button, it seem to be selected always and when a user does not know that and they click the enter button, it runs the macro again. How do de-select the command button once it's clicked? Thanks -- Dave Peterson |
All times are GMT +1. The time now is 05:18 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com