ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   What does "\" do in VBA (https://www.excelbanter.com/excel-programming/332662-what-does-%5C-do-vba.html)

Jeff

What does "\" do in VBA
 
Hello,

I hope this is not a silly question.

I was researching someones elses VBA project & noticed this line of code:

row_d = a + (currentIndex - 1) \ 10 + currentIndex - 1

I know the "/" means divide by but what does the "\" do in this above
equation, it doesn't mean divide as I tried that.


Any help would be greatly appreciated.

Thank you,
Jeff

Chip Pearson

What does "\" do in VBA
 
It means integer divide. It disregards any fractional part of the
result. E.g.,

8 \ 3 = 2


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"Jeff" wrote in message
...
Hello,

I hope this is not a silly question.

I was researching someones elses VBA project & noticed this
line of code:

row_d = a + (currentIndex - 1) \ 10 + currentIndex - 1

I know the "/" means divide by but what does the "\" do in this
above
equation, it doesn't mean divide as I tried that.


Any help would be greatly appreciated.

Thank you,
Jeff




Alan Beban[_2_]

What does "\" do in VBA
 
Chip Pearson wrote:
It means integer divide. It disregards any fractional part of the
result. E.g.,

8 \ 3 = 2


Before division is performed, the numeric expressions are rounded to
Byte, Integer, or Long expressions. E.g.,

8 \ 2.5 -------- 4 (it rounds the 2.5 to 2)
8 \ 2.6 -------- 3 (it rounds the 2.6 to 3)

Alan Beban



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

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