# Invoke code error - implicit conversion from double to integer

**URL:** <https://forum.uipath.com/t/invoke-code-error-implicit-conversion-from-double-to-integer/261205>\
**Category:** Activities\
**Tags:** excel, system, activities\
**Created:** [October 9, 2020, 1:01pm UTC](https://forum.uipath.com/t/invoke-code-error-implicit-conversion-from-double-to-integer/261205 "2020-10-09T13:01:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![T0Bi](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/t0bi/32/176797_2.png) [@T0Bi](https://forum.uipath.com/u/T0Bi)\
**Post date:** [October 9, 2020, 1:01pm UTC](https://forum.uipath.com/t/invoke-code-error-implicit-conversion-from-double-to-integer/261205/1 "2020-10-09T13:01:04Z")

</div>

Dear all,

I have a problem with the Invoke Code activity.

Here’s my code:

```
Dim d As Integer
Dim m As Integer
Dim name As String
d = colNum
name = ""
Do While (d > 0)
    m = (d - 1) Mod 26
    name = Chr(65 + m) + name
    d = Int((d - m) / 26)
Loop
colLetter = name

```

colNum and colLetter are arguments.

I get an error that the implicit conversion from double to integer is not allowed in line 9, which is the following line:

```
d = Int((d - m) / 26)

```

How am I supposed to change the code to make it work?

This is the easiest way to get a column letter (Excel) from an index.  
e.g. 27 =\> AA, 5 =\> E, etc.

- T0Bi

---

<div class="post-metadata">

**Author:** ![tomasz\_przemyslaw.wrobel](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/tomasz_przemyslaw.wrobel/32/514487_2.png) [@tomasz\_przemyslaw.wrobel](https://forum.uipath.com/u/tomasz_przemyslaw.wrobel)\
**Post date:** [October 9, 2020, 1:14pm UTC](https://forum.uipath.com/t/invoke-code-error-implicit-conversion-from-double-to-integer/261205/2 "2020-10-09T13:14:27Z")

</div>

use backslash to perform integer division.  
d = (d - m) \ 26

I think that your code should work, but for some reason UiPath decides otherwise.

---

<div class="post-metadata">

**Author:** ![T0Bi](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/t0bi/32/176797_2.png) [@T0Bi](https://forum.uipath.com/u/T0Bi)\
**Post date:** [October 9, 2020, 1:36pm UTC](https://forum.uipath.com/t/invoke-code-error-implicit-conversion-from-double-to-integer/261205/3 "2020-10-09T13:36:58Z")

</div>

With backslash it actually works. Never thought of that…

Thanks a lot 😃

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [October 12, 2020, 1:37pm UTC](https://forum.uipath.com/t/invoke-code-error-implicit-conversion-from-double-to-integer/261205/4 "2020-10-12T13:37:00Z")

</div>

Closed on October 12, 2020, 1:37pm UTC

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
