ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Functions in Excel macro (https://www.excelbanter.com/excel-programming/309831-functions-excel-macro.html)

Srikanth Ganesan[_2_]

Functions in Excel macro
 

Hello,

I am trying to write an Excel macro. I want to use the following
functions that are available in Excel. Please let me know what are the
corresponding VB functions/syntax for the macro:
Excel Functions:
MOD(n,k)
Floor(n,k)
Ceiling(n,k)

Thanks

Srikanth


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Norman Jones

Functions in Excel macro
 
Hi Srikanth

You can use the Floor and Ceiling worksheet functions in VBA thus:

Res = Application.WorksheetFunction.Floor(n, k)
Res = Application.WorksheetFunction.Ceiling(n, k)

VBA has its own Mod operator, the syntax being:

Res = n Mod k

---
Regards,
Norman



"Srikanth Ganesan" wrote in message
...

Hello,

I am trying to write an Excel macro. I want to use the following
functions that are available in Excel. Please let me know what are the
corresponding VB functions/syntax for the macro:
Excel Functions:
MOD(n,k)
Floor(n,k)
Ceiling(n,k)

Thanks

Srikanth


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!




Jim Cone

Functions in Excel macro
 
Srikanth,

x = n Mod k
x = WorksheetFunction.Floor(n, k)
x = WorksheetFunction.Ceiling(n, k)

Regards,
Jim Cone
San Francisco, CA

Srikanth Ganesan" wrote in message ...
Hello,
I am trying to write an Excel macro. I want to use the following
functions that are available in Excel. Please let me know what are the
corresponding VB functions/syntax for the macro:
Excel Functions:
MOD(n,k)
Floor(n,k)
Ceiling(n,k)
Thanks
Srikanth




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

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