Select range in Excel using Row Count

I would like to select a range in Excel from E2 to the last cell in Column F that contains a value. I used “Read range” first and set the output as variable “DT”. Then I used “select range” and input range as “E2:F+DT.Rows.Count.ToString”. But it gives me an error saying “The range does not exist”. Can someone help me with this issue? Thank you!

Hi @YwOli

What’s the value of the variable in your test case? have you tried reading/printing it?

Yes I tried to use message box to print out “DT.Rows.Count.ToString” and it managed to give me the correct number of rows. But when I write in the “Select range”, it cannot get the row number.

Ok, so i saw the problem

It is

“E2:F”+Var

Not

“E2:F+Var

The variable and operator have to be outside the quotes, else it read it as a litteral string

1 Like

Yes, you are right! My issue has been resolved. Thank you!

1 Like