Command Button

How_Do_I

Well-known Member
Joined
Oct 23, 2009
Messages
1,843
Office Version
  1. 2010
Platform
  1. Windows
I enter my data via a User Form. I've noted that when I press my command button to enter my data, if I press it again while my cursor is spinning and "thinking" about entering the correct data, then the next set of data can be entered. How can I prevent this please?
 
Yes, but what if somebody else uses this and presses away... I know not to keep pressing but I was hoping for a bit of VBA code as a fail safe.
 
Upvote 0

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
If you disable the button as soon as it's clicked and only re-enable it again when you're actually ready for it to be clicked again, that can't happen.

Code:
Private Sub CommandButton3_Click()
Dim ws As Worksheet
Dim MyForm As UserForm1
CommandButton3.Enabled = False
'
' rest of code 
'
CommandButton3.Enabled = True
End Sub

(Why couldn't Man U have played like that on Tuesday?!)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,596
Messages
6,179,807
Members
452,944
Latest member
2558216095

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