Get row index of a Selected Cell in Excel

Hi all,

I am trying to get the row index of a selected (or active) cell in Excel. The code search a cell and then, when I select that cell, I would like to know the row index of it.

Thanks

2 Likes

To get the index

Datatablename.Indexof(Columnname).ToString

dt1.Rows.IndexOf(row).ToString

Thanks
@JoaquinBS

1 Like

Check with the below code,
foreach(DataRow row in yourdatatable.Rows)
{
Int value_row_index =yourdatatable.Rows.Indexof(row)
//Writeline value_row_index.ToString()
}

Thank You :smiley:

2 Likes

I was rather looking for the following code in VBA somehow translated into UIPath: Application.ActiveCell.Row

What I want is the row number of the active cell.

Hi @JoaquinBS,

Welcome UiPath Forum Community !

To search the text in Excel you can use the find activity which is in the below . It will return the cellinfo like “A10”.“B5” as array.

Additional. It has a feature the return the rowindex as array. It is not available in UiPath go. but you can download from here .

Regards
Balamurugan.S

1 Like