Invoke code error - implicit conversion from double to integer

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
1 Like

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

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

2 Likes

With backslash it actually works. Never thought of that…

Thanks a lot :smiley:

1 Like

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