Userform Priorities

mr_g_99

Board Regular
Joined
Aug 11, 2015
Messages
58
I have a Userform with several Textboxes and two Command Buttons.
Tab Indexes are set and will tab through the Textboxes from start to finish,
My problem is, I need to be able to click CommandButton1 (NEW) and execute the sub assigned to that button while the cursor is tabbing thru the Textboxes.
Currently it seems whatever Textbox the cursor is at just ignores the CommandButton press (maybe the Textbox considers the button press a Textbox entry?)
Is there a way to set the CommandButton priority so that it takes precedence over a Textbox entry?
Does this make sense LOL??

Typical Textbox code:
VBA Code:
Private Sub TextBox1_AfterUpdate ()
      Execute code
End Sub

CommandButton code:
Code:
Private Sub CommandButton1_Click()
      Execute code
End Sub
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,093
Latest member
dbomb1414

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