Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Qn: Ensure Number is valid for a circle??
Hello Everyone,
I am trying to put in a error trap with a MsgBox to check and see if a number that is input into a TextBox is NOT a valid number. The TextBox input is for a Wind Direction such as 040 degrees, OR 180 degrees. Now, since the direction of the wind is only valid for 360 degrees in a circle, is there a way to ensure the number they input meets the criteria for a degree. Example: If they put in the number 36, my wind formula will not calculate the correct wind correction angle from the runway. The wind direction MUST be 360 to calculate properly. Can I do a error routine to ensure that?? Thanks in Advance... mv PS: Tom... your my man! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Ensure Number is valid for a circle??
Unless there is some other information you can use in conjunction with this
value, the best you could do is check that the number is between 0 and 359 inclusive or 1 and 360 inclusive. If your example represents entering 36 when 360 was intended, there is no way to determine that 360 was intended rather than 36 degrees. If you only accept numbers divisible by 5 or 10, then you could use the MOD operator to check that. (but 30 vice 300). Perhaps you could add an additional entry such as N, NW, SE etc and check your numbers in conjunction with that. In any event, your code would go in the exit event if the textbox is on a userform. -- Regards, Tom Ogilvy "Michael Vaughan" wrote in message ... Hello Everyone, I am trying to put in a error trap with a MsgBox to check and see if a number that is input into a TextBox is NOT a valid number. The TextBox input is for a Wind Direction such as 040 degrees, OR 180 degrees. Now, since the direction of the wind is only valid for 360 degrees in a circle, is there a way to ensure the number they input meets the criteria for a degree. Example: If they put in the number 36, my wind formula will not calculate the correct wind correction angle from the runway. The wind direction MUST be 360 to calculate properly. Can I do a error routine to ensure that?? Thanks in Advance... mv PS: Tom... your my man! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Ensure Number is valid for a circle??
Hi Michael
You can use the Exit event of the textbox to test the input. Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) If Not IsNumeric(TextBox1) Or Len(TextBox1) 3 Then Cancel = True Me.TextBox1.Text = Format(TextBox1, "000") End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Michael Vaughan" wrote in message ... Hello Everyone, I am trying to put in a error trap with a MsgBox to check and see if a number that is input into a TextBox is NOT a valid number. The TextBox input is for a Wind Direction such as 040 degrees, OR 180 degrees. Now, since the direction of the wind is only valid for 360 degrees in a circle, is there a way to ensure the number they input meets the criteria for a degree. Example: If they put in the number 36, my wind formula will not calculate the correct wind correction angle from the runway. The wind direction MUST be 360 to calculate properly. Can I do a error routine to ensure that?? Thanks in Advance... mv PS: Tom... your my man! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Ensure Number is valid for a circle??
Michael,
Instead of poping up an Input box, why not show them a userform with a compass-like graphic and arrow that they can drag around to the correct direction. You couls even only allow certain increments, 15o say. No validation required as the must give you a valid response and kudos for style. NickHK "Michael Vaughan" wrote in message ... Hello Everyone, I am trying to put in a error trap with a MsgBox to check and see if a number that is input into a TextBox is NOT a valid number. The TextBox input is for a Wind Direction such as 040 degrees, OR 180 degrees. Now, since the direction of the wind is only valid for 360 degrees in a circle, is there a way to ensure the number they input meets the criteria for a degree. Example: If they put in the number 36, my wind formula will not calculate the correct wind correction angle from the runway. The wind direction MUST be 360 to calculate properly. Can I do a error routine to ensure that?? Thanks in Advance... mv PS: Tom... your my man! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how do i circle a number? | Excel Discussion (Misc queries) | |||
How do I make circle within circle graphs in Excel 2003? | Charts and Charting in Excel | |||
How do I circle a number in excel | Excel Worksheet Functions | |||
In Excel, how can I type a number with a circle around it? | Excel Worksheet Functions | |||
How circle an individual number in a cell? | Excel Worksheet Functions |