My Int32 Variable keeps returning a negative value for the Row Index it is keeping track of


It keeps saying the range A-1 does not exist

It use to work just fine in the the previous version of the bot - and they look identical
Below is an image of the version that worked.
The only difference is the column Header name - and changing it from Title to Name is a trivial inconsequential difference.

Update:
refer to this comment for the issue - this is what I need help with

@jezaia.vanderwatt

You can actually direct use append range activity…which will avoid all of this

Altwrnately first print thw lastrow value and check what is getting returned

Cheers

1 Like

It has something to do with the Headers being selected - I have managed to get it working by recreating the activity from scratch - but this still doesn’t point out what the root cause of my problem was.

It might also be because the Variable name didn’t match. Eg: LastRow vs Last_Row.

AH! I descovered what’s wrong - LastRow the variable - set to Int32 - is returning a -1 instead of a 1 (example - when it is meant to say A1 (“A” + LastRow.ToString) ) - it sais “A-1” instead of “A1”

Any help to solve this would be apreciated.

The activity returns -1 if it can’t find any last populated row.

One workaround might be to check if LastRow is negative and change the value to 1 if it is.

LastRow = If (LastRow = -1, 1, LastRow)

(Insert the Assign activity after the Find the Last Data Row activity.)

Thank you - an if statement to re-assign its value by multiplying the result by -1 if the result is negative! Thank you.

I originally solved it by pasting the index value in a “Last Row” column (in F2) - and than use a find / replace activity to find and replace “-” with “”.

And than assign a string variable the value “A” + F2’s value as a string.
And than assign the data tables destination as Sheet.range(string variable)
(Yes I know - its a long winded butchered “shortcut” of a solution)

But your solution is much better!

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