User form

jcaptchaos2

Well-known Member
Joined
Sep 24, 2002
Messages
1,032
Office Version
  1. 365
Platform
  1. Windows
Is there a way to prevent wrong data from being entered into a user form? For example if I had a table on and the user went to enter a number into a user form and that number wasn't in my table then it wouldn't let them enter it. It would give them some sort of error?
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Why not use a combobox or listbox that only lists the valid numbers?

Or you could allow the user to enter a number then use Find or some other method to see if it's in the table.

If it's not tell the user and ask them to re-enter.:)
 
Upvote 0
Sorry I am new at user forms, would I use ControlSource for that? If so could you give me an example?

Thanks
 
Upvote 0
Not ControlSource, the property for populating is RowSource.

There are other ways to populate - List, AddItem etc - but if your unfamiliar with these type of controls RowSource is a good a place to start.

It should work fine as long as you are dealing with some sort of contiguous list of unique data.
 
Upvote 0
Thanks Norie, working on a large project so appreciate your help. I am sure you will see me around a lot in the next couple of weeks.

Can't thank you enough
JC
 
Upvote 0
No problem, I actually had 2nd thoughts about if I'd used the right name.:)

In some apps it's RecordSource for example.

By the way you should probably avoid using ControlSource.

It has it's uses but if you want to get data from worksheet to userform and vice versa it's sometimes better to rely on a little bit of code.
 
Upvote 0
Ok if you could help me one more time tonight, My list is on a sheet called "routings" and it goes from A2 - A700 so what do I type in RowSource?
 
Upvote 0

Forum statistics

Threads
1,214,411
Messages
6,119,360
Members
448,888
Latest member
Arle8907

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