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
 

Some videos you may like

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
22,965
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
 

Watch MrExcel Video

Forum statistics

Threads
1,089,995
Messages
5,411,720
Members
403,394
Latest member
Mohan Kumar

This Week's Hot Topics

Top