Get value of selected excel cell

excel

#1

Hi,
I need to get the value of the selected cell in excel, suppose if I have selected B1 then the value of the B1 cell should get picked.

Thanks,
Anjali


#2

You can try this way:

“Datatablename”.Rows(“rownumber”).Item(“columnName/columnNumber”)


#3

I can’t give rownum as it is dynamic


#4

then store the value in a variable and pass it on to Rownumber


#5

If you need to get the selected cell, then you might need to consider Invoke VBA and extract it from excel directly. However, it depends on what you are trying to do and you might not actually need to do that.

If you use Read Range or Read Cell activities, then you don’t need to get the selected cell as those activities will give you the values from the table.

As @phyogananda mentioned, if you have a datatable from the Read Range, then you can use .Rows() and/or .Item() to get the values you need.

EDIT: also, if you don’t know the row number, then you can use the “For each row” on the datatable until you find the row that matches a specific value.

Regards.