Remainder of division in VBA

nicksoph

Board Regular
Joined
Jun 13, 2009
Messages
55
Im working on a macro in CorelDraw part of which needs to simplify a rotational angle so that it is between 0 and 360 degrees eg. 361.5 is converted to 1.5 and 720.15 would become 0.15

In VBA it seems that the MOD function returns a rounded integer but I would like to keep the fractional part and I can't seem to find how to do this.

What am I missing? Happy to read and learn how to do this but cant seem to find a place to start.

Any advice would be appreciated.

Thanks
nick
 

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
22,895
Do it explicitly.

Remainder = Number - (Int(Number/Divisor) * Divisor)
 

nicksoph

Board Regular
Joined
Jun 13, 2009
Messages
55
Thanks Mike,
that's so straightforward - wish I had thought instead of searched.

nick
 

Forum statistics

Threads
1,086,033
Messages
5,387,396
Members
402,059
Latest member
wdyl121

Some videos you may like

This Week's Hot Topics

Top