ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Mod(number;divisor) (https://www.excelbanter.com/excel-programming/359247-mod-number%3Bdivisor.html)

Mhek[_2_]

Mod(number;divisor)
 

I would like to get the remainder in a script.

In an excel sheet, I use to write remainder = Mod(number;divisor)

but that function doesn't work with a VBA script.

I tried number%divisor (like I would do in C++) but it didn't work.

What should I do ?

Frank


--
Mhek
------------------------------------------------------------------------
Mhek's Profile: http://www.excelforum.com/member.php...o&userid=33427
View this thread: http://www.excelforum.com/showthread...hreadid=534122


Toppers

Mod(number;divisor)
 
rem = number MOD divisor

e.g

rem = 51 MOD 6

HTH

"Mhek" wrote:


I would like to get the remainder in a script.

In an excel sheet, I use to write remainder = Mod(number;divisor)

but that function doesn't work with a VBA script.

I tried number%divisor (like I would do in C++) but it didn't work.

What should I do ?

Frank


--
Mhek
------------------------------------------------------------------------
Mhek's Profile: http://www.excelforum.com/member.php...o&userid=33427
View this thread: http://www.excelforum.com/showthread...hreadid=534122



Tom Ogilvy

Mod(number;divisor)
 
Mod is an operator in VBA

remainder = 23 mod 10
? remainder
3

Note that the behavior is somewhat different from the Excel function for
non integers. See help.

--
Regards,
Tom Ogilvy




?
"Mhek" wrote:


I would like to get the remainder in a script.

In an excel sheet, I use to write remainder = Mod(number;divisor)

but that function doesn't work with a VBA script.

I tried number%divisor (like I would do in C++) but it didn't work.

What should I do ?

Frank


--
Mhek
------------------------------------------------------------------------
Mhek's Profile: http://www.excelforum.com/member.php...o&userid=33427
View this thread: http://www.excelforum.com/showthread...hreadid=534122




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

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