ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error: Sub or function not defined (https://www.excelbanter.com/excel-programming/332036-error-sub-function-not-defined.html)

cwilliams

Error: Sub or function not defined
 
I'm new in writing VBA and for the first time I tried to call an Excel
function from the VBA code and I received the error above. Here is the
statement:

Dim StartRowIndex(1 To 6)
Dim xAxisScaleMin(1 To 6)
xAxisScaleMin(i) = RoundDown(StartRowIndex(i) * 1440, 0) / 1440

I'm confused! I assumed that since the Rounddown function is a predefined
excel worksheet function it would work in VBA. What do I have to do?

Norman Jones

Error: Sub or function not defined
 
Hi C,

RoundDown is an Excel function, not a VBA function.

Try, therefo

Application.WorksheetFunction.RoundDown


---
Regards,
Norman



"cwilliams" wrote in message
...
I'm new in writing VBA and for the first time I tried to call an Excel
function from the VBA code and I received the error above. Here is the
statement:

Dim StartRowIndex(1 To 6)
Dim xAxisScaleMin(1 To 6)
xAxisScaleMin(i) = RoundDown(StartRowIndex(i) * 1440, 0) / 1440

I'm confused! I assumed that since the Rounddown function is a predefined
excel worksheet function it would work in VBA. What do I have to do?





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

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