ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using Functions in VBA code (https://www.excelbanter.com/excel-programming/345626-using-functions-vba-code.html)

Chris Gorham

Using Functions in VBA code
 
Hi,

I would like to use the funtion "rounddown" in some code that I'm writing.
The VBA help facility tells me that only "round" is available to me in VBA. I
believe that it is possible to import "rounddown" which is a function
available Excel s/sheet.

How do I do this...??

Thanks...Chris

bpeltzer

Using Functions in VBA code
 
Range("A1").Value = Int(Range("A1").Value) will round the value in A1 down to
the next lowest integer.

"Chris Gorham" wrote:

Hi,

I would like to use the funtion "rounddown" in some code that I'm writing.
The VBA help facility tells me that only "round" is available to me in VBA. I
believe that it is possible to import "rounddown" which is a function
available Excel s/sheet.

How do I do this...??

Thanks...Chris


chijanzen

Using Functions in VBA code
 
Chris Gorham:

Try:

MsgBox Application.WorksheetFunction.RoundDown(Range("A1" ), 2)

or

MsgBox Application.WorksheetFunction.RoundDown(100 / 33, 2)

--
http://www.vba.com.tw/plog/


"Chris Gorham" wrote:

Hi,

I would like to use the funtion "rounddown" in some code that I'm writing.
The VBA help facility tells me that only "round" is available to me in VBA. I
believe that it is possible to import "rounddown" which is a function
available Excel s/sheet.

How do I do this...??

Thanks...Chris



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com