How to use number of excel rows as while loop condition

I’m trying to make my While activity to loop the same number of times as the number of rows in an excel file. And since the number of row may change I can’t just use a number as the condition. The excel’s range has been read and I tried using the DTvariable.Rows.Count method but it won’t work and ended up just messing up the whole flow.
If anyone have any suggestions what else I can do please let me know

@Shadrina_Izzati

It should work. dataTable.Rows.Count

May I know what Error are you getting here ?

@Shadrina_Izzati datatable.Rows.Count type should be Int I think now it’s not in integer type

it’s not exactly an error as it just changes the whole loop flow. The loop flow is correct when I simply use a number in the condition but if I use datatable.Rows.Count the flow changes

@Shadrina_Izzati

Could you please show me screenshot of your while loop once. Will check it once.