VBA Floor/Celing commands
Okay, I am trying to figure out how to turn a value produced by a
formula and stored to a variable in my VB code into a whole number, but it needs to be rounded up no matter what the number (so if it is 32.004 the value needs to be passed as 33). In excel formulas, you can use floor or ceiling commands that can do this, but i cannot figure out how to do this in VB. Does anyone know how? Sample code below Dim cheese cheese = RWfLA.yards cheese = cheese / 9.5 [code to round number up] Thanks |
VBA Floor/Celing commands
Hi Bohica,
Try: cheese = application.roundup(cheese,0) --- Regards, Norman "BOHICA" wrote in message m... Okay, I am trying to figure out how to turn a value produced by a formula and stored to a variable in my VB code into a whole number, but it needs to be rounded up no matter what the number (so if it is 32.004 the value needs to be passed as 33). In excel formulas, you can use floor or ceiling commands that can do this, but i cannot figure out how to do this in VB. Does anyone know how? Sample code below Dim cheese cheese = RWfLA.yards cheese = cheese / 9.5 [code to round number up] Thanks |
VBA Floor/Celing commands
"Norman Jones" wrote in message ...
Hi Bohica, Try: cheese = application.roundup(cheese,0) --- Regards, Norman Norman, you are a freakin' genius. Exactly what value bumping I needed. Thanks |
VBA Floor/Celing commands
You can employ Excel's built-in functions via the WorksheetFunction object.
cheese = Application.WorksheetFunction.Ceiling(cheese,1) Regards, Vic Eldridge "BOHICA" wrote in message m... Okay, I am trying to figure out how to turn a value produced by a formula and stored to a variable in my VB code into a whole number, but it needs to be rounded up no matter what the number (so if it is 32.004 the value needs to be passed as 33). In excel formulas, you can use floor or ceiling commands that can do this, but i cannot figure out how to do this in VB. Does anyone know how? Sample code below Dim cheese cheese = RWfLA.yards cheese = cheese / 9.5 [code to round number up] Thanks |
All times are GMT +1. The time now is 12:57 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com