![]() |
custom round function
I'm writing a function to change the last integer in a numeric value t
either a 5 or a 9-(replicating a Peachtree function). The Select case functions is clearly an option, but how do I get th function to focus on the last integer ? The * doesn't work- example: Change 1442 to 1445 1327.55 to 1329 thanks -- Message posted from http://www.ExcelForum.com |
custom round function
On Fri, 16 Jan 2004 21:31:23 -0600, Princess Geek
wrote: I'm writing a function to change the last integer in a numeric value to either a 5 or a 9-(replicating a Peachtree function). The Select case functions is clearly an option, but how do I get the function to focus on the last integer ? The * doesn't work- example: Change 1442 to 1445 1327.55 to 1329 LastDigit = WorksheetFunction.Round(rg, 0) Mod 10 will give you the last digit of a rounded number. Something like: ====================== Function Round59(rg As Range) As Long Dim LastDigit As Integer LastDigit = WorksheetFunction.Round(rg, 0) Mod 10 Round59 = WorksheetFunction.RoundUp(rg / 5, 0) * 5 Round59 = Round59 + (LastDigit 5) End Function ======================== might do what you are looking for. --ron |
custom round function
|
custom round function
On Sat, 17 Jan 2004 07:12:22 -0600, Princess Geek
wrote: worked beautifully, thanks! You're welcome. --ron |
All times are GMT +1. The time now is 08:42 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com