Get used range

Refer to the following example code to see how to get the used range in the current range.