Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Could someone tell me why my value is rounding up to whole numbers, not allowing decimals, i.e. 1.50 or 1.75 etc? Sub EditAllowedVariance() Dim HasPswd As String Dim NuAllowance As Long HasPswd = InputBox("Enter Password", "Password") If HasPswd = "" Then 'do nothing Else If HasPswd = MyPassword Then NuAllowance = Val(InputBox("Enter desired allowed variance", "Enter Variance")) GrossUppg.Range("I2").NumberFormat = "00.00" GrossUppg.Range("I2").Value = NuAllowance Else MsgBox "Incorrect Password" End If End If End Sub -- Thanks for your help. Karen53 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It is probably due to your Dim'ming NuAllowance as a Long... Long's cannot
hold decimal values. Try Dim'ming it as Double and see if that helps. Rick "Karen53" wrote in message ... Hi, Could someone tell me why my value is rounding up to whole numbers, not allowing decimals, i.e. 1.50 or 1.75 etc? Sub EditAllowedVariance() Dim HasPswd As String Dim NuAllowance As Long HasPswd = InputBox("Enter Password", "Password") If HasPswd = "" Then 'do nothing Else If HasPswd = MyPassword Then NuAllowance = Val(InputBox("Enter desired allowed variance", "Enter Variance")) GrossUppg.Range("I2").NumberFormat = "00.00" GrossUppg.Range("I2").Value = NuAllowance Else MsgBox "Incorrect Password" End If End If End Sub -- Thanks for your help. Karen53 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Yes, Thank you, Rick!
-- Thanks for your help. Karen53 "Rick Rothstein (MVP - VB)" wrote: It is probably due to your Dim'ming NuAllowance as a Long... Long's cannot hold decimal values. Try Dim'ming it as Double and see if that helps. Rick "Karen53" wrote in message ... Hi, Could someone tell me why my value is rounding up to whole numbers, not allowing decimals, i.e. 1.50 or 1.75 etc? Sub EditAllowedVariance() Dim HasPswd As String Dim NuAllowance As Long HasPswd = InputBox("Enter Password", "Password") If HasPswd = "" Then 'do nothing Else If HasPswd = MyPassword Then NuAllowance = Val(InputBox("Enter desired allowed variance", "Enter Variance")) GrossUppg.Range("I2").NumberFormat = "00.00" GrossUppg.Range("I2").Value = NuAllowance Else MsgBox "Incorrect Password" End If End If End Sub -- Thanks for your help. Karen53 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Another question,
Is there a way I can set the password input box to mask the password with *? -- Thanks for your help. Karen53 "Rick Rothstein (MVP - VB)" wrote: It is probably due to your Dim'ming NuAllowance as a Long... Long's cannot hold decimal values. Try Dim'ming it as Double and see if that helps. Rick "Karen53" wrote in message ... Hi, Could someone tell me why my value is rounding up to whole numbers, not allowing decimals, i.e. 1.50 or 1.75 etc? Sub EditAllowedVariance() Dim HasPswd As String Dim NuAllowance As Long HasPswd = InputBox("Enter Password", "Password") If HasPswd = "" Then 'do nothing Else If HasPswd = MyPassword Then NuAllowance = Val(InputBox("Enter desired allowed variance", "Enter Variance")) GrossUppg.Range("I2").NumberFormat = "00.00" GrossUppg.Range("I2").Value = NuAllowance Else MsgBox "Incorrect Password" End If End If End Sub -- Thanks for your help. Karen53 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
yes, view the properties of the textbox and look for password character.
-- Gary Keramidas "Karen53" wrote in message ... Another question, Is there a way I can set the password input box to mask the password with *? -- Thanks for your help. Karen53 "Rick Rothstein (MVP - VB)" wrote: It is probably due to your Dim'ming NuAllowance as a Long... Long's cannot hold decimal values. Try Dim'ming it as Double and see if that helps. Rick "Karen53" wrote in message ... Hi, Could someone tell me why my value is rounding up to whole numbers, not allowing decimals, i.e. 1.50 or 1.75 etc? Sub EditAllowedVariance() Dim HasPswd As String Dim NuAllowance As Long HasPswd = InputBox("Enter Password", "Password") If HasPswd = "" Then 'do nothing Else If HasPswd = MyPassword Then NuAllowance = Val(InputBox("Enter desired allowed variance", "Enter Variance")) GrossUppg.Range("I2").NumberFormat = "00.00" GrossUppg.Range("I2").Value = NuAllowance Else MsgBox "Incorrect Password" End If End If End Sub -- Thanks for your help. Karen53 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you, Gary!
-- Thanks for your help. Karen53 "Gary Keramidas" wrote: yes, view the properties of the textbox and look for password character. -- Gary Keramidas "Karen53" wrote in message ... Another question, Is there a way I can set the password input box to mask the password with *? -- Thanks for your help. Karen53 "Rick Rothstein (MVP - VB)" wrote: It is probably due to your Dim'ming NuAllowance as a Long... Long's cannot hold decimal values. Try Dim'ming it as Double and see if that helps. Rick "Karen53" wrote in message ... Hi, Could someone tell me why my value is rounding up to whole numbers, not allowing decimals, i.e. 1.50 or 1.75 etc? Sub EditAllowedVariance() Dim HasPswd As String Dim NuAllowance As Long HasPswd = InputBox("Enter Password", "Password") If HasPswd = "" Then 'do nothing Else If HasPswd = MyPassword Then NuAllowance = Val(InputBox("Enter desired allowed variance", "Enter Variance")) GrossUppg.Range("I2").NumberFormat = "00.00" GrossUppg.Range("I2").Value = NuAllowance Else MsgBox "Incorrect Password" End If End If End Sub -- Thanks for your help. Karen53 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
ROUNDING FORMULA =ROUND(B12/$B$10,1) ROUNDING TO HIGH | Excel Worksheet Functions | |||
I need a formula with rounding up & rounding down to the nearest . | Excel Worksheet Functions | |||
Excel rounding bug for input to Variant data type | Excel Programming | |||
Worksheet rounding vs VBA rounding | Excel Programming | |||
CODE to select range based on User Input or Value of Input Field | Excel Programming |