Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm not quite sure of the correct terms but I want to test if a number
entered on a form is log of a power 10 ie, I want to know if the number entered is 0.001,0.01,0.1,1,10,100 etc. If then number is not one of this series, then the user has to go back and enter an acceptable number. Thanks Chris |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Assuming the number on the form is entered into a text box (TextBox1) and a command button on the form (CommandButton1) triggers the test you refer to then perhaps.... Private Sub CommandButton1_Click() Dim s As Double s = Application.WorksheetFunction.Log(Val(TextBox1)) If Int(s) = s Then MsgBox "Number OK" Else MsgBox "Number not OK" End If End Sub (Some error checking will be required that a number has been entered into the text box.) -- XL2003 Regards William "inquirer" wrote in message ... I'm not quite sure of the correct terms but I want to test if a number entered on a form is log of a power 10 ie, I want to know if the number entered is 0.001,0.01,0.1,1,10,100 etc. If then number is not one of this series, then the user has to go back and enter an acceptable number. Thanks Chris |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
This routine will check 10 to the power of -10 to +10. It returns TRUE or FALSE. Function Valid10(v) As Boolean For i = -10 To 10 Step 1 If v = Application.Power(10, i) Then Valid10 = True Exit Function End If Next i Valid10 = False End Function For example, =Valid10(A1) in cell B1 will check value of A1 or in VBA: Sub Test() Dim valid as Boolean MyValue=0.0001 valid=valid10(MyValue) End sub HTH "inquirer" wrote: I'm not quite sure of the correct terms but I want to test if a number entered on a form is log of a power 10 ie, I want to know if the number entered is 0.001,0.01,0.1,1,10,100 etc. If then number is not one of this series, then the user has to go back and enter an acceptable number. Thanks Chris |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The value of these newsgroups and the people who help amateurs like me is
immeasurable. Here was I thinking I was asking something near impossible and within a few hours I get 2 great solutions. Thank you Chris "William" wrote in message ... Assuming the number on the form is entered into a text box (TextBox1) and a command button on the form (CommandButton1) triggers the test you refer to then perhaps.... Private Sub CommandButton1_Click() Dim s As Double s = Application.WorksheetFunction.Log(Val(TextBox1)) If Int(s) = s Then MsgBox "Number OK" Else MsgBox "Number not OK" End If End Sub (Some error checking will be required that a number has been entered into the text box.) -- XL2003 Regards William "inquirer" wrote in message ... I'm not quite sure of the correct terms but I want to test if a number entered on a form is log of a power 10 ie, I want to know if the number entered is 0.001,0.01,0.1,1,10,100 etc. If then number is not one of this series, then the user has to go back and enter an acceptable number. Thanks Chris |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
make a check form, and then have info go to a check register | Excel Worksheet Functions | |||
Check Box and form | Excel Discussion (Misc queries) | |||
Using a template form, advance a form number everytime you open | Excel Discussion (Misc queries) | |||
form check box | Excel Worksheet Functions | |||
how can I make a form number change everytime the form is opened | Excel Worksheet Functions |