VBA ~ Input masks for a created User Form? Is this possible

MarianneR

New Member
Joined
Oct 13, 2005
Messages
7
Hi!

I'm a novice at VBA. I've created a User Form for people who are not experienced with Excel and I'm having a couple of problems.

1) The form includes text boxes as well as pull-downs (combo boxes). I was wondering if there was a way to use input masks (like in Access) to prevent uses from entering inappropriate data. For example, I have several date fields. Is it possible to have my user form already have a mm/dd/yyyy format for them? Or, if that's not possible, is there some way to make the User Form beep at them? I have prompts in the labels next to the boxes, but I'm afraid it won't be enough.

2) I'm also having problems with errors that my form is producing. If you click outside of the form boundaries or hit enter in some cells, there's an error with my Ok to quit statement:

Private Sub UserForm_Click()

Private OKToQuit As Boolean ' determines if button pressed to exit

End Sub

Private Sub Cancel_Click()
OKToQuit = True
Me.Hide
End Sub

Private Sub Apply_Click()
MsgBox "Button pressed; Apply choices"
OKToQuit = True
Me.Hide
End Sub


3) As I said, I've got combo boxes, but they let you type in them. Is there a way to make this NOT happen?

4) I don't understand the use of If statements in the code. For example, I have a particular yes/no question. If the user enters YES, I'd like them to enter a date in the next box. If either NO is entered or there's no information, I'd like to have that text box turned off. Is this possible?

Again, I'm really just learningthis, so your patience is appreciated. Or, I'm happy to share this with someone if that's easier ~ please leave me your email address.

Thanks!
Marianne
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

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