Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dropdown List That Accepts Other User Input GEdwards Excel Discussion (Misc queries) 5 April 5th 10 05:45 AM
How to restrict input to a list of values - with a twist Rod Excel Worksheet Functions 7 January 5th 09 05:26 AM
Formula to check against a list of valid values Barb W[_2_] Excel Worksheet Functions 3 March 4th 08 06:51 PM
Averaging values from a list, based on user input MWS Excel Worksheet Functions 3 June 5th 07 06:47 PM
How do I check for values in a list in an if statement? DJC Excel Discussion (Misc queries) 1 July 27th 05 07:13 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"