Cnvert ColumnName to ColumnNumber

Hi all,

Column name “A” is given

How to get the column Number from it

column Number would be 1

Got a function in vba “Columns(“A”).Column” how to use it

Thanks and Regards,
Supriya

Hi @supu123

Please give a try,

Dt - your datatable

Dt.columns.indexof("A")

Index will start with 0 , add +1 if yoo want to start with 1.

Thanks

Hi @prasath_S

The output is -1 for A

Thanks and Regards,
Supriya

For B also this is -1

@supu123 is the column names present in the datatable,it seems it is not there.

Also try this,this will convert excel column letter to index datatable is not required

UiPath.excel.helpers.excelutilities.convertcolumnlettertocolumnindex("B").tostring

Thanks

This works

Thankyou for help

1 Like

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