ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   User Name From List (https://www.excelbanter.com/excel-programming/306636-user-name-list.html)

novicevbaer

User Name From List
 
Hello.... I am trying to create user names so that when a user opens th
workbook and enters the user name into a sign on form their store numbe
and specific buying budget is entered into the beginning balance fo
forecasting. I easily did that by saying

If txtUser = apple then budget = $100,000

Now, however, I am wondering what I do if a user enters something tha
is not on the list at all? Is there a way to have the user form entr
compare to a list for validation?

And also, what do I do if the user entry is not validated? I wa
thinking about making the form read only at that point but I'm not sur
how to do this.

Any information or direction would be greatly appreciated as to ho
best to achieve this.

Thank you

--
Message posted from http://www.ExcelForum.com


Bob Flanagan

User Name From List
 
If you display a listbox containing the allowed names and require that a
name be selected before the dialog is closed, that would solve your
problems.

You can put a list of names on a worksheet and then populate the listbox
with them. The following is untested but should get you close: (and
debugging is always a learning experience!)

unload userform1
dim cell as range
set cell = sheets("where my list is").range("a1")
While not isempty(cell)
userform1.additem cell.value
set cell = cell.offset(1,0)
Wend
do
Userform1.show
if userform1.listbox1.listindex < -1 then exit do
msgbox "Please make a selecton"
Loop
msgbox "You selected list item " & userform1.listbox1.listindex+1

Robert Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"novicevbaer " wrote in message
...
Hello.... I am trying to create user names so that when a user opens the
workbook and enters the user name into a sign on form their store number
and specific buying budget is entered into the beginning balance for
forecasting. I easily did that by saying

If txtUser = apple then budget = $100,000

Now, however, I am wondering what I do if a user enters something that
is not on the list at all? Is there a way to have the user form entry
compare to a list for validation?

And also, what do I do if the user entry is not validated? I was
thinking about making the form read only at that point but I'm not sure
how to do this.

Any information or direction would be greatly appreciated as to how
best to achieve this.

Thank you!


---
Message posted from http://www.ExcelForum.com/




novicevbaer[_2_]

User Name From List
 
I'm sorry I should have stated that the users can't see a list of th
user names or they could just enter another store's username and se
their information

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 12:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com