Loop condition


#1

I have a problem

that in this picture i want to write in excel by the given formula but i want this to be done in loop. loop until when it find the last non blank cell and then stop.


#2

Hi,

You will have to make an expression that converts the loop index to the required target and value string for the Write Cell activity. Ideally, run the index from the same row number as the Excel data, so you can write "C" & row.ToString as the target cell and String.Format("=MAX(E{0}:BB{0})-E{0}", row) as the cell value. For the loop condition you can use similar syntax to Read Cell on the current (Do loop) or next cell (Do While loop) and then check that “readValue IsNot Nothing” (i.e. the value just read is not null).


#3

Hello,

You don’t want to do a loop on a formula. There is a Filldown keystroke combination you can use. - Ctrl+D

Select Range

TypeInto
"[d(ctrl)]d[u(ctrl)]"

For the Select Range you will need to use a datatable from Read Range I think to get the Row count. so range might be “B”+row.ToString+":B"+(dt.Rows.Count+1).ToString

My 2 cents.
Thanks.


#4

Thanxx ClaytonM it is working.