Get value of selected excel cell

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.


You can try this way:


I can’t give rownum as it is dynamic

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

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.



I have an excel with 2 columns A and B.
For example-- col A has got the values C, D, E
Col B has got the corresponding values F, G, H respectively.
Now I want check if value D exists in colA then it should pick value G of colB. Similarly for other values of col A and B.

Pls suggest.


Hey @Vibhasa, this will depend on what you are trying to do.

But, let’s assume you already have a list of values which we can say are our Transaction items, and the current item will be “D” like in your example…

Then, I would normally apply some .net to jump directly to the row that contains that value. Once, you have the row, then you can get the value in all columns of that row.

Let’s also assume at this point, you have already used an Excel Read Range to get your data table (I’ll call sourceDT)

It would look like this where item represents “D”:

assign matchedRows = sourceDT.AsEnumerable.Where(Function(r) r("A").ToString.ToUpper.Trim = item.ToString.ToUpper.Trim).ToArray

If activity: matchedRows.Count > 0
    assign valueB = matchedRows(0)("B").ToString.Trim
    <do something else when no rows are found>

So, basically, you find matched rows as an Array, check its count to make sure it found a match, then finally pull the value from column “B”

There is also another method which uses more logic, but can be slower and more cluttered at times. That method is to use an If activity inside a loop, until you find the match.
Like this:

For each row in sourceDT
    If activity: row("A").ToString.ToUpper.Trim = item.ToString.ToUpper.Trim
         valueB = row("B").ToString.ToUpper.Trim

Hope that helps.


1 Like

Thanks @ClaytonM .
Sharing excel and xaml file here.
There are two columns Market and URL
Take a an input “value” from the user what the user looking for in Market
Now I need to check if Market contains “value”
then pick the corresponding value from URL.



Hi @ClaytonM

Can u please suggest for the above Workflow?