Trouble with a command button.

JohnPoole

Active Member
Joined
Jun 9, 2005
Messages
267
I have a command button which has both a single click and a double click routine. Is there anyway to make the single click routine run only once without locking or disabling it after it is clicked, so that the double click routine can still be called, but the single click routine can no longer be used?
Any help greatly appreciated........
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
John

I don't quite follow. Could you give more details?

What do the seperate events do?

Where is the command button located?
 
Upvote 0
Hi, the single click event simply loads a picture to the commandbutton and minuses 1 to a counter, the double click event minuses 1 to the counter and disables the button until the form is reset. My problem arises in that I want the single click event to be recorded only once, if a user clicks single clicks more than once the counter is reduced by the number of the single clicks. I therfore wish to disable the single click event after it has been used once, leaving only the double click event available. Hope this makes sense. thanks for your help!
 
Upvote 0
John

Still not quite getting it, perhaps a Saturday night thing.:)

Where is your code/button located?

Is it on a userform?

If it is I suppose you could use a variable to indicate whether or not the single click event has been run.

When the userform opens it would be False, then it would be set True on the first run of the event.

The code for the event could check the variable to see if the event has been run previously, and act accordingingly ie. stop execeution of the code.
 
Upvote 0
Hi Norri, thanks for your reply. yes the button is on a userform. i'll try and use your method and see how far i get :) . I'll leave some feedback once I've given it ago. many thanks.
 
Upvote 0
Hi Norri,
Many thanks for the advice, got the button working perfectly using a variable to detect if the button had already been clicked as you suggested. Many thanks! :biggrin:
 
Upvote 0

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,072
Latest member
DW Draft

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top