![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Here is the code that I currently have. It works as long as the user either
leaves it blank or enters a correct number. However, I can't figure out how to insert an if then for when the user enters a wrong number without it having an error. Any help is appreciated. Option Explicit Sub GetAnswer() ' Created by CJ 'Enter an abbreviation and this will tell you which branch it is for. Dim Num As Variant Dim Answer As Variant Dim msg As String Dim Ans As Variant Dim Nums As Variant 'Prompt for a value Do Num = InputBox("What is the branch number you would like to look up?") 'Exit if cancelled If Num = "" Then Exit Sub 'Look up the abbreviation and return an answer. Answer = Application.VLookup(CLng(Num), Range("BranchNumbers"), 4, False) 'Show which branch the number goes to MsgBox Num & " is the Branch " & Answer & "." 'Ask if they would like to look up another number msg = MsgBox("Would you like to look up another branch?", vbYesNo) Loop While msg = vbYes End Sub Thanks CJ |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Combo box | skar3000 | Outlook - Using Forms | 3 | June 15th 07 02:14 PM |
Adding calender in a combo box | Mark the Outlook Idiot | Outlook - Using Forms | 2 | February 7th 07 07:26 PM |
Combo Box values resetting | [email protected] | Outlook - Using Forms | 2 | October 31st 06 05:01 PM |
Populate a combo box | Steffkm | Outlook - Using Forms | 4 | March 14th 06 09:28 PM |
Dropdown controls - List vs Combo | Don Smith | Outlook - Using Forms | 2 | January 20th 06 07:46 PM |