Identifying end range in Excel

Hi,

So i have an excel file where the number of rows keep changing.
Capture-1

For Eg:
I would want to copy A6 to C13, i.e the last row… this last row keeps varying… Any help on how do i proceed

Leave the last cell range as blank. Just entering the starting range alone will work fine.

@Karthick_Settu Thanks for the quick response!

But that would take the entire range right → A6 : D13 …? I want to do till C13…

Read like I previously said and then Find the number of rows present in the datatable. Then calculate your row number based on the starting cell you gave. By this way you can find the row number then add your column name.

Also check this link:

1 Like

Read Range From A5 then it will read all data then
By using Datatable.Rows.Count you will get the total rows count
so by adding 5 in that count you will get the last row no as 13
Read Range----------“A5”---->op Datatable
Assign------“Datatable.Rows.Count+5”------------Count–>op 13

2 Likes

@hss

If you want to get the last row count.
Read the Excel into a data table Dt1.
use Assign activity count=Dt1.Rows.count.toString
use Read Range Activity specify Range as “A6:C”+count

Regards,
A Manohar

1 Like

@Karthick_Settu
Thanks that worked… just one more combination i tried:

Here I would like to get only A6 to C13, the above said method will give me a range of A6:C23
Note: I have the column letter, need to know the row number for such cases…

In this case you have to find out the empty cells. As a range it will indicate only the last cell row. So, you have to find the last empty cell in that column.

Any Idea on how we can do it? @Karthick_Settu

Read the excel sheet as datatable and find out the last non-empty cell in that column.

@Karthick_Settu So I read the column instead of the datatable, since my column name is fixed only rows vary. Then i follow the logic given by u. Thanks my problem is Solved !

1 Like

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