VBA Operators \ and /

Ideas and tips for enhancing your TM1 application
Post Reply
User avatar
Steve Rowe
Site Admin
Posts: 1818
Joined: Wed May 14, 2008 4:25 pm
OLAP Product: TM1
Version: 10.2.2., PAW
Excel Version: Nearly all of them

VBA Operators \ and /

Post by Steve Rowe » Tue Apr 21, 2009 10:49 am

Just thought I'd put this out there for people as it's just tripped me up as I have spent a while debugging VBA trying to understand why a division was always producing an integer result.

Through force of habit of writing TM1 rules using the "\" to suppress divide by zero I'd written

applyValue = (Target.Value - currentTotal) \ 12

for some custom spreading functionality in VBA.

From the VBA help

/ Operator
Used to divide two numbers and return a floating-point result.

\ Operator
Used to divide two numbers and return an integer result.

I thought I had some kind of data type problem as I was not getting the result I wanted but I had used \ in error and should be using /.

I didn't even know that \ was valid in VBA.


Post Reply