Message box code

ftsang

New Member
Joined
Jun 9, 2005
Messages
25
Hi guys,
I have a message box for a macro which says "Please pick a number".
Now, I have a list of pre-defined numbers which I wish the user to pick (which are in no sequential order, and there are about 3000 of them). I want the message box to say something like "please pick a valid number" and return to the "enter a number" message box if the user does not enter a number in my list. Help is greatly appreciated!

Thanks, Merry Xmas!

Frank
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Unfortunately because there are about 3000 different cases, it would take too long to write a Case Is = statement or an else if statement for each one, so those 2 methods do not help.

Plus the numbers change on a weekly basis (but are listed within the excel workbook). I do not really want to use a drop down list, is there a way to code it so that if a number entered in the inputbox is not in this list, it will redirect me to the input box?
 
Upvote 0
How about using data validation on the cell instead?

You could use a dynamic named range for the choice list, then if someone inputs an invalid number (not in the list) you could use the data validation Error Alert notice to handle it.
 
Upvote 0
Hiya,
Thanks for the help, I want to give users the options of a) using a drop down list (and using validation), or, if they know the number, I want them to be able to type it in and use the macro, but have the code to notify them of any typo's they may enter!

Is this possible??
 
Upvote 0

Forum statistics

Threads
1,213,561
Messages
6,114,317
Members
448,564
Latest member
ED38

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top