get the row number of first empty row of excel sheet

Dear apple friends ,

I am using the apple script to paste certain specific contents of all excel sheets in one target sheet. To paste the contents of the next sheet (target) I have to figure out the first empty row number of target sheet , mean all the cells of the rows are empty . The number of this row will be used to configure the pasting range of the next sheet . The general logic is some what like this.

tell application “Microsoft Excel”
open excel_file
activate sheet ( target sheet)

repeat with row_num from start_row to end_row

if row is empty then
–main aim
set desired_row_num to row_num which is empty
exit repeat
end if
end repeat

–use row number to configure range

set paste_range_start to column_name(known) & desired_row_num
end tell

Any kind of help in this will be highly appreciated .

thanks in advance

best regards


Hi krishna,

try this:

tell application "Microsoft Excel" to tell active sheet
	set firstEmptyRow to range ("A" & ((count rows of used range) + 1))
end tell

Thanks a lot stefan

It worked