Ah, I think you are right. Your first reply suggests to change line 16 to
Return RandomizeNo(totalLot)
but what I did was changing line 19 with the suggested code. That's why it caused infinite looping LOL.
Yes, both snippets below work.
If randomizeAgain = True Then
Return RandomizeNo(totalLot)
End If
Return intLot
If randomizeAgain = True Then
Return RandomizeNo(totalLot)
Else
Return intLot
End If
Actually I modified/simplified the function a bit to make it easier for readers to see the function flow. I just wanted to mention the function calling in the function assuming readers would ignore the For Looping part.
Well it works now! Just by adding the word 'Return' in line 16 ;)
Thanks a lot.