464,564 Members | 906 Online
Need help? Post your question and get tips & solutions from a community of 464,564 IT Pros & Developers. It's quick & easy.

# Help! Rounding up!

 P: 44 HELP! I have a text box that rounds up a value. The code used is: Expand|Select|Wrap|Line Numbers Select Case Salary     Case 10000 To 99999         fRoundSalary = CLng(Fix(curSalary) / 1000) * 1000     Case 100000 To 999999         fRoundSalary = CLng(Fix(curSalary) / 10000) * 10000     Case Else End Select It works and rounds \$31,179.20 to \$31.000, but what if I need it to round up and give me an output of \$32,000? Is it possible? And how should it be coded? May 24 '07 #1
5 Replies

 P: 52 Someone better than me will need to answer your question, but I think 31499 and under will round to 3100 and 31500 and up will round to 32000, I haven't been able to find a way around that... good luck! I'll be watching to see if anyone knows this for sure! :) theAybaras May 24 '07 #2

 Expert 5K+ P: 8,750 HELP! I have a text box that rounds up a value. The code used is: Select Case Salary Case 10000 To 99999 fRoundSalary = CLng(Fix(curSalary) / 1000) * 1000 Case 100000 To 999999 fRoundSalary = CLng(Fix(curSalary) / 10000) * 10000 Case Else End Select It works and rounds \$31,179.20 to \$31.000, but what if I need it to round up and give me an output of \$32,000? Is it possible? And how should it be coded? Expand|Select|Wrap|Line Numbers (CLng(Fix(curSalary) / 1000) * 1000) + 1000 May 24 '07 #3

 Expert Mod 15k+ P: 31,770 Expand|Select|Wrap|Line Numbers Dim lngRound As Long   Select Case curSalary     Case 1000 To 9999         lngRound = 100     Case 10000 To 99999         lngRound = 1000     Case 100000 To 999999         lngRound = 10000     Case 1000000 To 9999999         lngRound = 100000 End Select fRoundSalary = ((curSalary + lngRound - 1) \ lngRound) * lngRound May 25 '07 #4

 P: 44 Expand|Select|Wrap|Line Numbers (CLng(Fix(curSalary) / 1000) * 1000) + 1000 Thank you! Thank you! It worked! May 25 '07 #5

 Expert 5K+ P: 8,750 Thank you! Thank you! It worked! Glad we were able to help you. May 25 '07 #6