User form

jcaptchaos2

Well-known Member
Joined
Sep 24, 2002
Messages
1,026
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?
 

Some videos you may like

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,742
Office Version
365
Platform
Windows
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.:)
 

jcaptchaos2

Well-known Member
Joined
Sep 24, 2002
Messages
1,026
Sorry I am new at user forms, would I use ControlSource for that? If so could you give me an example?

Thanks
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,742
Office Version
365
Platform
Windows
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.
 

jcaptchaos2

Well-known Member
Joined
Sep 24, 2002
Messages
1,026

ADVERTISEMENT

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
 

jcaptchaos2

Well-known Member
Joined
Sep 24, 2002
Messages
1,026

ADVERTISEMENT

Sorry if I use a combo box then I do
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,742
Office Version
365
Platform
Windows
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.
 

jcaptchaos2

Well-known Member
Joined
Sep 24, 2002
Messages
1,026
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?
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,300
Messages
5,510,484
Members
408,791
Latest member
bwirth

This Week's Hot Topics

  • Turn fraction around
    Hello I need to turn a fraction around, for example I have 1/3 but I need to present as 3/1
  • TIme Clock record reformatting to ???
    Hello All, I'd like some help formatting this (Tbl-A)(Loaded via Power Query) [ATTACH type="full" width="511px" alt="PQdata.png"]22252[/ATTACH]...
  • TextBox Match
    hi, I am having a few issues with my code below, what I need it to do is when they enter a value in textbox8 (QTY) either 1,2 or 3 the 3 textboxes...
  • Using Large function based on Multiple Criteria
    Hello, I can't seem to get a Large formula to work based on two criteria's. I can easily get a oldest value based one value, but I'm struggling...
  • Can you check my code please
    Hi, Im going round in circles with a Compil Error End With Without With Here is the code [CODE=rich] Private Sub...
  • Combining 2 pivot tables into 1 chart
    Hello everyone, My question sounds simple but I do not know the answer. I have 2 pivot tables and 2 charts that go with this. However I want to...
Top