Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default 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
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default 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



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
FLOOR FUNCTION Confused Excel Discussion (Misc queries) 5 November 11th 09 03:24 AM
More function than FLOOR() ! wilchong via OfficeKB.com New Users to Excel 12 August 6th 08 12:47 AM
floor function srroduin Excel Worksheet Functions 2 May 12th 06 10:11 PM
Something like CEILING or FLOOR gusvenables Excel Worksheet Functions 3 October 28th 05 04:09 AM
ceiling & floor Bill Ridgeway New Users to Excel 1 August 7th 05 02:32 PM


All times are GMT +1. The time now is 11:47 PM.

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

About Us

"It's about Microsoft Excel"