MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Working with Userform Controls

January 14, 2002 - by Bill Jelen

GH asks:

I'm facing a problem today, I have a user form with 5 different text boxes, 3 of those text boxes are mandatory. If I don't put nothing in one of those text boxes and I click the command button to perform the verification, I have a message box that appears and tells me that the text box "XXXX" is mandatory. When I click OK on this message box I would like my VBA project to select/activate the text box where data is mandatory.

Use the .SetFocus command: