Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Check a user-input value against a list of values?
I need a basic vba routine that pops up a dialogue box so a user enters his
id. Then it checks his id against the id_list on the ID sheet that's in workbook. If the Id is found in the list (which means it's a valid id) then the routine executes. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Check a user-input value against a list of values?
Try something like this
Sub check_id() Dim enterID As String Dim foundID As Range enterID = InputBox("Enter your id") If enterID < "" Then With Worksheets("ID").Range("A2:A10") 'id list here Set foundID = .Find(enterID, LookIn:=xlValues) End With If Not foundID Is Nothing Then MsgBox "Rest of code or macro call here" Else MsgBox "ID not found" End If Else MsgBox "User clicked cancel or did not enter id" End If End Sub Hope this helps Rowan "Bill_S" wrote: I need a basic vba routine that pops up a dialogue box so a user enters his id. Then it checks his id against the id_list on the ID sheet that's in workbook. If the Id is found in the list (which means it's a valid id) then the routine executes. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Dropdown List That Accepts Other User Input | Excel Discussion (Misc queries) | |||
How to restrict input to a list of values - with a twist | Excel Worksheet Functions | |||
Formula to check against a list of valid values | Excel Worksheet Functions | |||
Averaging values from a list, based on user input | Excel Worksheet Functions | |||
How do I check for values in a list in an if statement? | Excel Discussion (Misc queries) |