By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,642 Members | 2,136 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,642 IT Pros & Developers. It's quick & easy.

Need Help Please! Validation Vba!

P: 1
Hi!
I am having sort of a problem with a school assingnment.
I need to create a macro that checks if the content in a cell is a number. If the value is a percentage, I need the macro to check if the value is between 0% and 100%. I also need the macro to give the user a message if a mistake occurs (using MsgBox).... I've done the first part, using IsNumeric, but I can not figure out how to do the other instructions.. Please help me out, Close to deadline!
Dec 5 '07 #1
Share this Question
Share on Google+
2 Replies


lee123
100+
P: 556
I don't think there is anyone here that are suppose to help you out with you home work.

lee123
Dec 5 '07 #2

kadghar
Expert 100+
P: 1,295
Hi!
...Please help me out, Close to deadline!
as lee said, you're supposed to do the homework to learn by yourself. Anyway, some tips might be of help:

IsNumeric is a nice function to check if the content is numeric. Since there's no functiont to check if its a percentage, you can check the NUMBERFORMAT of the cell, to see if its set to "percentage".

With an AND inside the conditions of the IF you can check if the number is between 0 and 1.

A simple messagebox is simple to show, just write something like:
msgbox "this is a msgbox"

HTH
Dec 5 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.