Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 333
Default Input box rounding

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default Input box rounding

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 333
Default Input box rounding

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 333
Default Input box rounding

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 364
Default Input box rounding

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 333
Default Input box rounding

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ROUNDING FORMULA =ROUND(B12/$B$10,1) ROUNDING TO HIGH SunshineinFt.Myers[_2_] Excel Worksheet Functions 7 March 5th 09 06:41 PM
I need a formula with rounding up & rounding down to the nearest . Tony Kay Excel Worksheet Functions 3 May 29th 07 11:13 PM
Excel rounding bug for input to Variant data type Greg[_24_] Excel Programming 0 January 18th 06 08:36 PM
Worksheet rounding vs VBA rounding Simon Cleal Excel Programming 4 September 2nd 05 01:50 AM
CODE to select range based on User Input or Value of Input Field Sandi Gauthier Excel Programming 4 December 8th 03 03:22 PM


All times are GMT +1. The time now is 01:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"