ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   VBA worksheet function (https://www.excelbanter.com/excel-discussion-misc-queries/69430-vba-worksheet-function.html)

Jeff

VBA worksheet function
 
Hi,

I was trying to use a worksheet function in the VBA module and it isn't
working.

I type

Dim x as double

x = Application.Int(4.03)

and I get an error. Are we unable to use some worksheet functions in VBA?

Thanks for your help

MSgtMark

VBA worksheet function
 
Jeff,

Just take off the "Application" part. Like this:

Dim x As Double

x = Int(4.03)

Mark

"Jeff" wrote:

Hi,

I was trying to use a worksheet function in the VBA module and it isn't
working.

I type

Dim x as double

x = Application.Int(4.03)

and I get an error. Are we unable to use some worksheet functions in VBA?

Thanks for your help


Bob Umlas

VBA worksheet function
 
INT is builtin to VBA, so the worksheet function isn't available. Use
x=int(4.03)

"Jeff" wrote in message
...
Hi,

I was trying to use a worksheet function in the VBA module and it isn't
working.

I type

Dim x as double

x = Application.Int(4.03)

and I get an error. Are we unable to use some worksheet functions in VBA?

Thanks for your help





All times are GMT +1. The time now is 10:29 AM.

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