Issue with Column in Excel Write Cell

HI, I am using this code to populate an excel cell

Audit.Sheet(“Audit Log”).Cell(“B” + Saved.Values(Of ExcelValue)(“LastRowPlusOne”).ToString)

I keep getting a warning that Cell B0 does not exist. This was copied from an existing answer to the issue of finding the last row in excel and so i’m not sure why I am getting this error message

Hi @ieptus !

Indeed, in excel, the coordinate B0 does not exist. That probably means that the sheet you’re writing on is empty.
You can add before the code to populate the excel cell an IF condition, with something like:
IF Saved.Values(Of ExcelValue)(“LastRowPlusOne”).ToString = “0”
THEN Saved.Values(Of ExcelValue)(“LastRowPlusOne”) = “1”

Then, out of the IF sequence, you can use your usual way to populate your excel cell

Let us know if it does not work as expected :wink:

AHHHHH its so frustrating, thanks for the reply. I took the easy way and populated the first cell with a date, it works fine now, thank you.
Is there an easier way of setting the index rather than adding some data?

Sorry Hiba, thats what your code does :slightly_smiling_face:

1 Like

Haha you’re welcome !
Happy automation :grinning_face_with_smiling_eyes:

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