Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel VBA Input Box is rounding numbers automatically 1

Status
Not open for further replies.

wildek

MIS
Mar 6, 2002
23
US
Please see this thread (originally posted in wrong forum).
thread222-1054027
 

Code:
Range("U1").Value= "Temp Rate"
Columns("U:U").NumberFormat = "#,##0.0000"
so what's the problem???

Skip,

[glasses] [red]Be advised:[/red]When Viscounts were guillotined just as they were disclosing where their jewels were hidden, it shows to go that you should...
Never hatchet your Counts before they chicken! [tongue]
 
Are you using the VBA InputBox function or the Excel InputBox method ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
This is my input box code:
Code:
Dim SB1446_FootCare_Rate
For MY_ROWS = 1 To ActiveSheet.UsedRange.Rows.Count
If (Range("N" & MY_ROWS).Value) >= 0.01 And (Range("H" & MY_ROWS).Value) = ("H720") And (Range("C" & MY_ROWS).Value) = "1446" Then
    SB1446_FootCare_Rate = InputBox("Enter the H720 - Foot Care Home Visit (Weekday) Rate for employee 1446")
    Range("U" & MY_ROWS).FormulaR1C1 = SB1446_FootCare_Rate And Range("D" & MY_ROWS).ClearContents
End If
Next MY_ROWS

The user enters in an amount like 20.66 but on the excel sheet it comes up as 21.00 even though I put this before the above code:
Code:
Range("U1").Value= "Temp Rate"
Columns("U:U").NumberFormat = "#,##0.0000"
 
This line doesn't look right:

Range("U" & MY_ROWS).FormulaR1C1 = SB1446_FootCare_Rate And Range("D" & MY_ROWS).ClearContents

What is it supposed to do?
 
It is supposed to enter in the rate that the user inputs into Column U and delete the information (a rate code) in column D.

I also tried

Code:
Range("U" & MY_ROWS).Value = SB1446_FootCare_Rate And Range("D" & MY_ROWS).ClearContents
 
It should work as 2 statements.

Range("U" & MY_ROWS).Value = SB1446_FootCare_Rate
Range("D" & MY_ROWS).ClearContents

"And" is a logical operator which doesn't really belong here.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top