Can I have variable assignment in While Loop condition?

Lets have simple loop:

value=srcSheet.getCellByPosition(0,srcRowNo).String
DO While value<>"" 
	srcRowNo=srcRowNo+1
	value=srcSheet.getCellByPosition(0,srcRowNo).String
Loop

is it possible assign variable in DO WHILE condition check so i dont have to read the value for the initial time?

Something like this does not work:

DO While value=srcSheet.getCellByPosition(0,srcRowNo).String<>"" 
	srcRowNo=srcRowNo+1
Loop

Your first listing is the standard way to handle do while ... loop. You have to assign an initial value to the variable that you use in the condition for entering or continuing the loop, then it has to be updated. You cannot avoid entering the same code twice. Of course you also have to initialise srcRowNo.

There is an alternative to the do while ... loop, the repeat ... until. In that case the condition is tested at the end of the loop instead of at the start, so the loop will be executed at least once. But you still have to set the initial value for the condition outside the loop.

Hi

If you use the Value variable only to test if the cell is empty, you can do without it:

while srcSheet.getCellByPosition(0,srcRowNo).String <> ""
    srcRowNo=srcRowNo+1
wend

Also, if I can afford one tip it is best not to use variable names that may be reserved words.

Regards